I figured it out with a foreach loop as follows:
foreach(Control ctrl in pnlOptionDdl.Controls)
{
DropDownList ddl = ctrl as DropDownList;
if(ddl!=null){
HttpContext.Current.Response.Write(ddl.SelectedIte m.Text.ToString());
}
}
Thanks though :)
"Dilip Krishnan" <dilipdotnet..NOSPAM..@apdiya.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Could you post the code that causes this failure? I suspect you havent
added it to the controls collection of the panel
Mike wrote: Can someone help me figure this out...
I've created dropdown boxes dynamically and added them to a panel on my
page.
how do i get the selectedvalue of the dropdownlist from the panel when i
click the submit button?
I've tryed :
pnlName.Controls[0]
to see if that would find the dropdownlist control but says:
Specified argument was out of the range of valid values. Parameter name:
index
Thanks in advance
Mike
--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com