I'm inserting a dropdwon list in datagrid on row editing. When i run the project the datasource is not rekognized. The asp.net part is there:
<asp:TemplateField HeaderText="Lookup 1">
<EditItemTemplate>
<asp:DropDownList
ID="Loocup1DropDownList"
Width="100%"
runat="server"
DataSource ="<%GetValueF开发者_如何学JAVAorDropDownCombinationContent()%>"
DataValueField="LOOKUP_ID"
DataTextField="lookup_name" >
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LOOKUP1_NAME" runat="server" Text='<%# Bind("LOOKUP1_NAME") %>'></asp:Label>
</ItemTemplate>
This is the vb.net function:
Protected Function GetValueForDropDownCombinationContent() As DataSet
Dim dsProductLookups As New DataSet
dsProductLookups = DocumentManager.Data.DataRepository.Provider.ExecuteDataSet("sp_GetCombinationsLookups", productCombo.SelectedValue)
Return dsProductLookups
End Function
any ideas???
First thing you should be looking at is the way you apply your data source. It should be
DataSource='<%# GetValueForDropDownCombinationContent() %>'
Use the single quotes instead of double quotes. At least this works 100% in C#, and I'm hoping that it's the same in VB.NET..
Secondly - you didn't set the selected value there:
SelectedValue='<%# Bind("LOOKUP1_NAME") %>'
With these two applied - you should have no problems getting your dropdown to work )
精彩评论