how can i add row to table dynamically?
-
I want to insert row to table(which is asp.net control) after first click, row was inserted to table(list3_table.Rows.Count == 1) but after i click again, list3_table.Rows.Count is 0 (i am checking when page_load event) why the list3_table can't save row? and how can i solve this problem? aspx cs. protected void Button1_Click(object sender, EventArgs e) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); Literal gradeLister = new Literal(); gradeLister.Text = list1_drop.SelectedValue; tc.Controls.Add(gradeLister); tr.Controls.Add(tc); list3_table.Controls.Add(tr); }
hi My english is a little. anyway, nice to meet you~~ and give me your advice anytime~
-
I want to insert row to table(which is asp.net control) after first click, row was inserted to table(list3_table.Rows.Count == 1) but after i click again, list3_table.Rows.Count is 0 (i am checking when page_load event) why the list3_table can't save row? and how can i solve this problem? aspx cs. protected void Button1_Click(object sender, EventArgs e) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); Literal gradeLister = new Literal(); gradeLister.Text = list1_drop.SelectedValue; tc.Controls.Add(gradeLister); tr.Controls.Add(tc); list3_table.Controls.Add(tr); }
hi My english is a little. anyway, nice to meet you~~ and give me your advice anytime~
Have you looked at using a Gridview control on your page ?