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

Setting the TOP row as default value

1 Answer 68 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sanjay Singh
Top achievements
Rank 1
Sanjay Singh asked on 10 Jun 2010, 07:37 PM
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.


1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 14 Jun 2010, 01:31 PM
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.
Tags
ComboBox
Asked by
Sanjay Singh
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or