Avatar of Bruce
Bruce
Flag 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.

.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
Bruce

8/22/2022 - Mon
SOLUTION
nmarun

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
nmarun

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Bruce

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy