Selected item in a RadComboBox in editform

2 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 02 Apr 2009 Link to this post


    I've a RadComboBox in a Gridview Editform. It is filled from a dataclass in the code behind. When I go to edit mode, how do I set the selected value to that in the database.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2009 Link to this post

    Hello Andy,

     If you are using a custom EditForm with a RadComboBox in it then you can either set the selected index of the combobox as shown below:
          <telerik:RadComboBox ID="RadComboBox1" runat="server"

     protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
                GridEditFormItem editFormItem = (GridEditFormItem)e.Item; 
                RadComboBox combo = (RadComboBox)editFormItem.FindControl("RadComboBox1"); 
                combo.DataSourceID = "SqlDataSource1"
                combo.DataTextField = "ContactName"
                combo.SelectedIndex = e.Item.ItemIndex; 

  3. DevCraft R3 2016 release webinar banner
Back to Top