G
Guest
I try to move textBoxes and ddl dynamically to a ASP:table and everything
works correctly, except that for the ddl's the selectedValue is not retained
(it is for the TextBoxes).
Here is my code:
private void LoadTable()
{
Table1.Rows.Clear();
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Controls.Add(Page.FindControl("TextBox1"));
TextBox1.Visible = true;
c.Controls.Add(Page.FindControl("DropDownList1"));
DropDownList1.Visible = true;
if (tbxHidden.Text == "")
{
DropDownList1.Items.Clear();
DropDownList1.Items.Add("Value1");
DropDownList1.Items.Add("Value2");
DropDownList1.Items.Add("Value3");
}
r.Cells.Add(c);
Table1.Rows.Add(r);
TableDummy.Rows.Clear();
tbxHidden.Text = "IsLoaded";
TableCell cd= new TableCell();
TableRow rd = new TableRow();
cd.Controls.Add(Page.FindControl("tbxHidden"));
rd.Cells.Add(cd);
TableDummy.Rows.Add(rd);
}
Is this a bug ?
works correctly, except that for the ddl's the selectedValue is not retained
(it is for the TextBoxes).
Here is my code:
private void LoadTable()
{
Table1.Rows.Clear();
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Controls.Add(Page.FindControl("TextBox1"));
TextBox1.Visible = true;
c.Controls.Add(Page.FindControl("DropDownList1"));
DropDownList1.Visible = true;
if (tbxHidden.Text == "")
{
DropDownList1.Items.Clear();
DropDownList1.Items.Add("Value1");
DropDownList1.Items.Add("Value2");
DropDownList1.Items.Add("Value3");
}
r.Cells.Add(c);
Table1.Rows.Add(r);
TableDummy.Rows.Clear();
tbxHidden.Text = "IsLoaded";
TableCell cd= new TableCell();
TableRow rd = new TableRow();
cd.Controls.Add(Page.FindControl("tbxHidden"));
rd.Cells.Add(cd);
TableDummy.Rows.Add(rd);
}
Is this a bug ?