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

problems retrieving selected item on combobox

1 Answer 49 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ignacio Ortuzar
Top achievements
Rank 1
Ignacio Ortuzar asked on 18 Mar 2010, 07:29 PM
Hi,

I'm having some problems using the radcombobox.

I'm loading the combobox with an ObjectDataSource and when I want to get the selectedItem, selectedValue or selectedIndex, they are always null, "" or -1.

I was reading that combobox cannot access data when you use on demand loading, but what's mean?

that it's the code:
<telerik:RadComboBox ID="rcb_leads" runat="server" Width="290px" 
        DataValueField="IDLEAD" Filter="Contains" DataTextField="EMAIL"  
        DataSourceID="ods_getLeads" Text="Search" AutoPostBack="True"  
            onselectedindexchanged="rcb_leads_SelectedIndexChanged" > 
        <HeaderTemplate> 
            <table style="width: 275px" cellspacing="0" cellpadding="0"
                <tr> 
                    <td style="width: 177px;"
                        Lead Name</td> 
                    <td style="width: 60px;"
                        Email</td> 
                </tr> 
            </table> 
        </HeaderTemplate> 
        <ItemTemplate> 
            <table style="width: 275px" cellspacing="0" cellpadding="0"
                <tr> 
                    <td style="width: 177px;"
                        <%# Eval("FIRSTNAME") + " " + Eval("LASTNAME") %></td
                    <td style="width: 60px;"
                        <%# Eval("EMAIL") %></td
                </tr> 
            </table> 
        </ItemTemplate> 
    </telerik:RadComboBox> 

and the datasource:

 <asp:ObjectDataSource ID="ods_getLeads" runat="server"  
        SelectMethod="GetLeadByUserId" TypeName="LeadSius.stuff.DataAccess"
        <SelectParameters> 
            <asp:SessionParameter Name="userId" SessionField="_userId" Type="Int32" /> 
        </SelectParameters> 
    </asp:ObjectDataSource> 

What is wrong with that?

Regards

1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 22 Mar 2010, 02:49 PM
If you use LoadOnDemand with the RadComboBox you cannot access the SelectedItems and SelectedIndex on the server-side. For a further explanation of this you can read over this documentation article:

http://www.telerik.com/help/aspnet-ajax/load-on-demand-access-items-server-side.html

You can use the SelectedValue property I believe (the article mentions it as well) and perhaps that will help you in this scenario.



Tags
ComboBox
Asked by
Ignacio Ortuzar
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or