I am dynamically creating several dropdown list on the selection changed event of a main (static) dropdown list. These are created in The TableCell of default Table. When submit button is clicked I need to load a new page with selected values of dropdown as parameters. Basically I need to get the dropdown results in the second page.
This is how dropboxes are created:
while (reader.Read())
{
pcID = int.Parse(reader["fk_pcID"].ToString());
pcDesc = GetpcDescription(pcID);
List<Product> prodList = GetProductsBypcID(pcID);
DropDownList ddList = new DropDownList();
ddList.ID = "ddlPC" + pcID;
foreach(Product prod in prodList)
{
ddList.Items.Add(new ListItem(prod.ProductName, prod.ProductID.ToString()));
}
TableCell cell1 = new TableCell();
cell1.Text = pcDesc;
TableCell cell2 = new TableCell();
cell2.Controls.Add(ddList);
TableRow row = new TableRow();
row.Cells.Add(cell1);
row.Cells.Add(cell2);
table.Rows.Add(row);
}
EDIT: The above code runs at the selection changed event of a dropdown which is set to runat server. But dynamically created dropdowns are not set to run at server