Accessing control in nested datalist

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.
 
B

Brock Allen

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.
 
G

Guest

Thanks for the reply Brock. The nested datalist is populated dynamically
from a database. How then, would I get the DataListItem. Thanks.
 
B

Brock Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top