Author: peuge | Posted on: 6/30/2010 2:10:49 AM | Views : 276

Hey all,
I have a dropdownlist on my page which has autopostback set to true. On postback I populate a runat server div with a bunch of other DropDownLists. I then  have a button which does another postback to save the selections. Because the second set of dropdownlists are dynamically generated I cannot for the life of me figure out how to get their selected values?
1st DropDownList
<asp:DropDownList ID="ddlPageType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PageTypeChanged"></asp:DropDownList>

PageTypeChanged event
string category = "";

foreach (DataRow dr in dtOptions.Rows)
{
string cat = dr["categoryname"].ToString();
if (cat != category)
{
Literal lblCat = new Literal ...

Go to the complete details ...