You must Sign In to post a response.
  • Category: ASP.NET

    Add next row in html table with textbox column in


    I am using html table.In that table i am using 5 textbox columns.when i entered the last column i want to add next row in asp with coding.
    Thanks in advance
  • #769413
    You can add a new row using jquery or javascript, if you want to do it on client side by handling the onblur event of the last column entered. Adding a new row on the server side using VB.NET will make a post back to server and it will be an expensive operation.
    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #769416
    Protected void TextBox5_TextChanged (object sender, System.EventArgs e)
    // Total number of rows.
    int rowCnt;
    // Current row count.
    int rowCtr;
    // Total number of cells per row (columns).
    int cellCtr;
    // Current cell counter.
    int cellCnt;

    rowCnt = 1;
    cellCnt = 5;

    for(rowCtr=1; rowCtr <= rowCnt; rowCtr++) {
    // Create a new row and add it to the table.
    TableRow tRow = new TableRow();
    for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++) {
    // Create a new cell and add it to the row.
    TableCell tCell = new TableCell();
    // Mock up a product ID.
    string prodID = rowCtr + "_" + cellCtr;

    // Add a literal text as control.
    tCell.Controls.Add(new LiteralControl("Buy: "));
    // Create a Hyperlink Web server control and add it to the cell.
    System.Web.UI.WebControls.HyperLink h = new HyperLink();
    h.Text = rowCtr + ":" + cellCtr;
    h.NavigateUrl = "";

  • Sign In to post your comments