dropdownlist in a datalist

  • Thread starter Thread starter Brent Burkart
  • Start date Start date
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
 
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
 
Back
Top