Accessing control in nested datalist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a nested datalist with a dropdownlist. I need to capture the
selectedvalue of the dropdownlist so I can update a database table. My
question then is...how do I get the value from the nested datalist? Thanks
for any help.
 
You'll need to get the DataListItem in your DataList you want, then use FindControl("YourDropDownListID")
to fetach the control. You'll have to cast the return value to your control's
type.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Thanks for the reply Brock. The nested datalist is populated dynamically
from a database. How then, would I get the DataListItem. Thanks.
 
You get the DataListItem based upon which ever entry you need. How does the
user tell you? I assume you'll have a button of some sort for each item yes?
In that case handle the DataList's ItemCommand event. The e.Item parameter
is the ListItem that contained the button that was pressed.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Back
Top