DropDownList and DataGrid HELP!!!!!!!!!!

mumick

New member
Joined
May 3, 2005
Messages
1
Location
Milwaukee, WI
Programming Experience
Beginner
Hi vb.net pros,
I got a big problem with my dropdownlist control, it keeps bothering me more, more. I have a web form with datagrid on it. That datagrid contains multiple columns, one of them has dropdownlist control in it. How do I populate that dropdownlist control for each record in my datagrid.

ProductID is my unique field, ServiceLevel has multiple values for each ProductID (ELITE, SELECT, NEXT DAY, MLC). So what I need to do is to populate dropdownlist for each ProductID.

ProductID | ListPrice | ContractPrice | ServiceLevel | TotalSellPrice
1312-231 | $100.00| $20.00 | ELITE,SELECT, | $90.00
NEXT DAY

Here is the code behind I use to populate dropdownlist for one ProductID
VB.NET:
Public Function BindServiceLevel() As SqlDataReader 
Dim Conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("Connection"))
Dim cmdSelectDDL As SqlCommand = New SqlCommand("SELECT ServiceLevel FROM ServicePlan WHERE ProductID='44SB150-0000' ", Conn)
Conn.Open()
Return cmdSelectDDL.ExecuteReader(CommandBehavior.CloseConnection)
End Function

Here is my HTML:

HTML:
<asp:TemplateColumn HeaderText="Service Level">
<ItemTemplate>
<asp:DropDownList id="ddlServiceLevel" DataSource='<%# BindServiceLevel()%>' DataTextField="ServiceLevel" DataValueField="ServiceLevel" runat="server" AutoPostBack="False"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>

Please help, thanks in advance.
 
Top Bottom