G
Guest
For simplicity sake,
How do you get the value of selected dropdown on a postback? I understand
for a dynamic control, you need to re-create it on each postback, but how do
I modify the code to grab the SelectedValue?
protected void Page_Load(object sender, EventArgs e)
{
DropDownList list = new DropDownList();
list.ID = "DropDownList1";
list.Items.Add(new ListItem("1", "One"));
list.Items.Add(new ListItem("2", "Two"));
list.Items.Add(new ListItem("3", "Three"));
PlaceHolder1.Controls.Add(list);
}
How do you get the value of selected dropdown on a postback? I understand
for a dynamic control, you need to re-create it on each postback, but how do
I modify the code to grab the SelectedValue?
protected void Page_Load(object sender, EventArgs e)
{
DropDownList list = new DropDownList();
list.ID = "DropDownList1";
list.Items.Add(new ListItem("1", "One"));
list.Items.Add(new ListItem("2", "Two"));
list.Items.Add(new ListItem("3", "Three"));
PlaceHolder1.Controls.Add(list);
}