This is a migrated thread and some comments may be shown as answers.

Combo Box not returning data row from stored procedure

1 Answer 215 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
TSCGlobal
Top achievements
Rank 1
TSCGlobal asked on 03 Feb 2010, 03:00 PM

I have a stored procedure that accepts a parameter ("UserID") via a session variable, and returns specific data.  The data in question comprises of multiple columns containing branch number, and address.  I have tested this query, and it performs correctly, returning the necessary data.  However, when testing the page (and combo box), the combo box does not list the data, but rather has an item in it that says "System.Data.DataRowView" - and nothing else.  This has me a little lost, as I am not certain why it is doing this.  Here's the requisite code:

'This is the code behind code for the page_load event;  
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
 
        Dim conn As New SqlClient.SqlConnection  
        Dim cmd As New SqlClient.SqlCommand  
 
        MemUser = Membership.GetUser()  
        UserID = MemUser.UserName.ToString()  
 
        Session("UserID") = UserID & "@tscgrpsolutions.com" 
 
    End Sub 
<!-- Here's the combo box & datasource--> 
<telerik:RadComboBox ID="ddlSelectStore" runat="server" Skin="Black" Width="300px"   
        DataSourceID="sqlStoreSelect">  
</telerik:RadComboBox> 
 
<!-- Data Connections--> 
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"   
    ConnectionString="<%$ ConnectionStrings:xxxxxxxxxx%>"   
    SelectCommand="StoreSelectCommand" SelectCommandType="StoredProcedure">  
    <SelectParameters> 
        <asp:SessionParameter DefaultValue="xxxxxxxxxxxxxx"   
            Name="RepName" SessionField="UserID" Type="String" /> 
    </SelectParameters> 
</asp:SqlDataSource> 

The data returned comprises of 4 or 5 columns. 

Update: I did try doing a SQL select command directly to the database from the ASP.NET data source, and was able to populate the combo box. HOWEVER, the first item in the combo box still says "System.Data.DataRowView", and I cannot select any of the items the combo box is populated with. I have no idea why...

Any direction would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 05 Feb 2010, 05:03 PM
Hi beemer,

I can suggest you to set the DataTextField and DataValueField properties of the RedComboBox for example like this:

<telerik:RadComboBox ID="ddlSelectStore" runat="server" Skin="Black" Width="300px"  
    DataSourceID="sqlStoreSelect" DataTextField="StoreName"
      DataValueField="StoreID"
</telerik:RadComboBox>


Sincerely yours,
Kalina
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
ComboBox
Asked by
TSCGlobal
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or