How can I bind data from a database to a ListBox
control in ASP.NET?
views:
80answers:
2
A:
Basically, you:
make a connection to the database and select the data (there are a whole bunch of variables that will dictate the best way to do this)
ensure your data is in an IEnumerable container, such as List< object>
assign the IEnumerable list to the Items/ItemSource property of the control
call DataBind() on the control
Of course this won't work for every control, a textbox will have to be done differently. This probably didn't help you much at all, when you have more exact questions then people can give you more exact answers. If you ask vague questions with a lot of different ways of achieving the desired outcome then nobody can give you exact step by step instructions.
slugster
2010-04-29 06:57:12