views:

45

answers:

1

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 ="<%GetValueForDropDownCombinationContent()%>"
                                   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???

A: 

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 )

Artiom Chilaru