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

selected value always show empty

1 Answer 45 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
ARUN RAJA
Top achievements
Rank 1
ARUN RAJA asked on 17 Jul 2010, 07:25 AM
I am simply trying to read the selected value of an item that is selected in RadComboBox but I am unable to do so.  The SelectedValue value is always empty.  This is a pretty simple usage case so I don't understand why this should be difficult.  Does anyone know what is going on?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim cmd As New SqlCommand
    Dim con As New SqlConnection
    Dim da As New SqlDataAdapter
    Dim ds As New DataSet
 If (Not Page.IsPostBack) Then
    cmd.Connection = con
    con.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
 
    con.Open()
    cmd.CommandText = "select top 100 CustomerID, isnull(Title, '') as Title, FirstName, LastName, FirstName + LastName as FullName from saleslt.customer"
 
    da.SelectCommand = cmd
    da.Fill(ds)
 
    RadComboBox1.DataValueField = "CustomerID"
    RadComboBox1.DataTextField = "FullName"
 
    RadComboBox1.DataSource = ds
    RadComboBox1.DataBind()
end if
End Sub
 
Protected Sub RadComboBox1_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
    Dim s As String
 
    s = e.Value
    s = RadComboBox1.SelectedValue
 
End Sub

<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="420"
    AllowCustomText="True" MaxHeight="300px" Filter="Contains" AutoPostBack="True">
    <HeaderTemplate>
        <ul>
            <li class="col1">Title</li>
            <li class="col2">First Name</li>
            <li class="col3">Last Name</li>
        </ul>
    </HeaderTemplate>
    <ItemTemplate>
        <ul>
            <li class="col1"><%#DataBinder.Eval(Container.DataItem, "Title").ToString()%></li>
            <li class="col2"><%#DataBinder.Eval(Container.DataItem, "FirstName").ToString()%></li>
            <li class="col3"><%#DataBinder.Eval(Container.DataItem, "LastName").ToString()%></li>
        </ul>
    </ItemTemplate>
</telerik:RadComboBox>

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 22 Jul 2010, 12:41 PM
Hello ARUN RAJA,

I tested your code on my side and it works properly.
Please find the test page attached and give it a try. Maybe I miss something?

Sincerely yours,
Kalina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
ARUN RAJA
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or