Click here to Skip to main content
14,925,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanted to Dynamically Add Row to HTML Table which had already 3,3 rows ,cols on Button Click.and how to retrive the values from the dynamically created textboxes....
Menelaos Vergis 4-Oct-12 6:41am
You have to ether use AJAX Panel of ASP and postback with the new row created at the datasource or you have to relay only on client side code

<pre lang="c#">
Tr=new HtmltableRow();
Tc=New HtmlTableCell();
//content of Tc
What is the problem then. Use loop to create Rows & Columns to the table and add those rows to the Table.
Try something like this:
//Creating a new table object
Table tbl = new Table();
tbl.Width = Unit.Percentage(100);
TableRow tblRow = new TableRow();
int cellInd = 0;
for (int i = 0; i < 3; i++)
    //Creating a new row index
    tblRow = new TableRow();
    for (int j = 0; j < 3; j++)
        //Creating a new column for the above row index
        TableCell tblCell = new TableCell();
        tblCell.Width = Unit.Percentage(25);

Hope it helps.
srinath.pothineni 5-Oct-12 7:56am
how to get the details from the dynamically created text boxes and i want to store those values into the database..
_Amy 5-Oct-12 8:09am
use FindControl with respective ID to find the Dynamically created textboxes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900