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

Loadondemand and problem in obtaining selected value

2 Answers 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Canis Lupus
Top achievements
Rank 1
Canis Lupus asked on 28 Dec 2010, 03:56 PM
Hello,

I am using loadondemand for a radcombobox control as follow:

<telerik:RadComboBox ID="DDL_district" Runat="server"
DataSourceID="DS_district" DataTextField="fullAddress  
DataValueField
="recID" Width="100%" AppendDataBoundItems="True"
                            EnableAutomaticLoadOnDemand="True" Filter="Contains"
                            MinFilterLength="3" ShowMoreResultsBox="True"
                            EnableVirtualScrolling="True" ItemsPerRequest="10"
                            LoadingMessage="Loading...."
                            EmptyMessage="No such district in the database."
                            MaxHeight="250px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Selected="True"
                                    Text="some text"
                                    Value="0" />
                            </Items>
                          </telerik:RadComboBox>

when I try to obtain the selected value in run-time I always get "0" value even if I select an item from database.
I use following code to get districtID value

Dim districtID As String = DDL_district.SelectedValue

Am I missing something?

2 Answers, 1 is accepted

Sort by
0
msigman
Top achievements
Rank 2
answered on 29 Dec 2010, 04:12 AM
You've put for the value:
Value="0"

Try to set the value to a meaningful number, or string.  Or you could use the SelectedItem property instead.
0
Dimitar Terziev
Telerik team
answered on 03 Jan 2011, 03:53 PM
Hi Mehmet,

Sorry for my late response.

In order to get the selected items value in server-side first you should perform a postback.
I've prepared a small example for you showing how to get the value of the selected item from the combobox.
Also you could check this article here for more information.
I hope this will help.



Best wishes,
Dimitar Terziev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
Canis Lupus
Top achievements
Rank 1
Answers by
msigman
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Share this question
or