dropdownlist in a datalist

B

Brent Burkart

Can anyone direct me to a tutorial on how to set up a dropdownlist in a
datalist? Each dropdownlist in the datalist needs to pull back different
information based on the datalist item it resides in.

I am not having much luck finding any information on this.

Any help is appreciated.

Thanks,
Brent
 
M

Matt Hawley

Hi Brent,

What you need to do is set up a public/protected method that returns an IEnumerable data source, such as a DataSet, DataTable, etc.

The input parameters can be whatever you need to make the data distinct.

Then, in your DataList, just use the following code:

<asp:DropDownList runat="server" id="DropDownList1" DataSource='<%# GetMyData(<ADD INPUT PARAMETERS>) %>' DataMember="<IF NEEDED>" DataTextField="Field1" DataValueField="Field2" />

Matt Hawley, MCAD .NET
http://www.eworldui.net

Can anyone direct me to a tutorial on how to set up a dropdownlist in a
datalist? Each dropdownlist in the datalist needs to pull back different
information based on the datalist item it resides in.

I am not having much luck finding any information on this.

Any help is appreciated.

Thanks,
Brent
 

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,796
Messages
2,569,645
Members
45,371
Latest member
TroyHursey

Latest Threads

Top