Link to home
Create AccountLog in
Avatar of Bruce
BruceFlag for United States of America

asked on

How do I programmatically add items to a DataList ASP.NET Control?

I am trying to bind data programmatically to to a datalist control.  The reason I am not using the standard, set source->DataBind, is that the DataList is dynamically created within the Pane of an AJAX Accordian control.  

My goal is to have a datalist filled with checkbox controls.  At this point I really just need to know how to add items to my dynamically instantiated DataList control.

SOLUTION
Avatar of nmarun
nmarun
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Bruce

ASKER

Thanks nmarun for the response.  Sorry I think I need to be more clear.  Your examples do not include the DataList.Controls.Add construct.  It is there where I am having difficulty.  I am instantiating a DataListItem but I don't see where I can set the text for it.  Is there someway I can setup a "template" as is done on the page but populated from the code behind?
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.