Setting the TOP row as default value

2 posts, 0 answers
  1. Sanjay Singh
    Sanjay Singh avatar
    7 posts
    Member since:
    Mar 2010

    Posted 10 Jun 2010 Link to this post

    RAD COMBO BOX
                rcb.DataSource = Datasource
                rcb.DataTextField = "Name"
                rcb.DataValueField = "ID
                rcb.DataBind()

    When I try to read the value "SelectedValue" it's blank.
    I have to populate another combo box/Grid based on default value selected during first load.


  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 14 Jun 2010 Link to this post

    Hello Sanjay Singh,

    You should subscribe to the OnDataBound event of the RadComboBox and then get the SelectedValue like this:

    protected void RadComboBox1_DataBound(object sender, EventArgs e)
        {
            string selectedValue = RadComboBox1.SelectedValue;
            string selectedItem = RadComboBox1.SelectedItem.Text;
            MessageBox.Show("Selected item is: " + selectedItem + " with value: " + selectedValue);
        }

    Find the full code in the attached .zip file.

    Hope this helps.

    Regards,
    Veronica Milcheva
    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.
Back to Top