I have been trying to fetch ids of dynamically created dropdownlists(during Page_Load) ,which are in a table, and then find the selected values in those dropdownlists and store these values a table or GridView on button click.This is how i assigned id's(in Page_Load event)
drd.ID = "dbaseid" + rowctr;
drd1id[rowctr]=drd1.ID;
rowctr is the index variable to assign unique id to each dropdown.
How do i fetch the ids from Page_Load . I tried storing the id in an array and then using session variable:
drdid[rowctr]=drd.ID;
drd1id[rowctr]=drd1.ID;
Session["drditem"]=drditem;
Session["drd1item"]=drd1item;
and then tried to fetch the ids in buttonclick event function:
drdid=(string[])Session["drdid"];
drd1id=(string[])Session["drd1id"];
string[] a =new string [50];
for(int i =0;i<noodropdowns;i++)
{
a=drd1id[i];
a.selectedindex//doesnt work !!
}
Is there a way to get the real ids and then work on them ? I m new to asp.net , My apologies if it sounds noob ish .. thanks in advance.
Found success ,found the dropdowns and saved the selected values in a table .Every time a value from a drop down is selected it is changed in the table as well.Here is the code..
}