RadComboBox SelectedIndexChanged event not firing when using inplace editing in a RadGrid

7 posts, 0 answers
  1. Tim
    Tim avatar
    60 posts
    Member since:
    May 2011

    Posted 21 Dec 2011 Link to this post

    I am using inplace editing on a RadGrid that is built using a class file. Everything is working well except I am having an issue the SelectedIndexChanged event not firing when the grid is in edit mode. Any thoughts?

    Column Definition:
    GridDropDownColumn _ID = new GridDropDownColumn
                                 DataField = "ID",
                                 HeaderText = "ID",
                                 UniqueName = "ID",
                                 ListTextField = "ID",
                                 ListValueField = "ID",
                                 ListDataMember = "ID",
                                 DropDownControlType = GridDropDownColumnControlType.RadComboBox,
                                 HeaderStyle = { Width = Unit.Pixel(140) },
                                 ItemStyle = { Width = Unit.Pixel(140) },
                                 ReadOnly = false,
                                 Display = true,

    UserControl Code:
    private void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                if ((e.Item as GridDataItem) == null) { return; }
                ((RadNumericTextBox) (e.Item as GridDataItem)["Percentage"].Controls[0]).Width = Unit.Pixel(75);
                ((TextBox) (e.Item as GridDataItem)["Code"].Controls[0]).Width = Unit.Pixel(75);
                RadComboBox _participantList = (e.Item as GridEditableItem)["ID"].Controls[0] as RadComboBox;
                if (null == _participantList) { return; }
                _participantList.Width = Unit.Pixel(120);
                _participantList.DataValueField = "ID";
                _participantList.DataTextField = "ID";
                _participantList.AutoPostBack = true;
                _participantList.DataSource = MAASBaseInterface.ParticipantAPI.GetParticipants();
                _participantList.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(_participantList_SelectedIndexChanged);
                if (!(e.Item.DataItem is GridInsertionObject))
                    _participantList.SelectedValue = ((Participant) (e.Item.DataItem)).ID.ToString();
                if (e.Item.DataItem is GridInsertionObject)
                    _participantList.EmptyMessage = "-- Select --";
            catch (Exception ex)
                string _ex = ex.Message;
    void _participantList_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        //first reference the edited grid item through the NamingContainer attribute
        GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;
        int _selectedValue = Convert.ToInt32((editedItem["ID"].Controls[0] as RadComboBox).SelectedValue);
        ParticipantList _participants = MAASBaseInterface.ParticipantAPI.GetParticipants();
        Participant _participant = _participants.Where(a => a.ID == _selectedValue) as Participant;
        RadTextBox _code = editedItem["Code"].Controls[0] as RadTextBox;
        _code.ReadOnly = false;
        _code.Text = _participant.Code;

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Dec 2011 Link to this post

    Hello Tim,

    Try setting AutoPostBack as true  for DropDown.

  3. Tim
    Tim avatar
    60 posts
    Member since:
    May 2011

    Posted 22 Dec 2011 Link to this post

    Hi Shinu, if you will look closer at the code you will see this line _participantList.AutoPostBack = true;
  4. Tim
    Tim avatar
    60 posts
    Member since:
    May 2011

    Posted 22 Dec 2011 Link to this post

    I figured it out with the help of this post. The problem was that I was only setting the Value property of the RadComboBox and not the Text property. Even though text value was showing in the RadComboBox in edit mode apparently it was displaying the Value property. As soon as it was set it started posting back just like it was supposed to do.

    RadGrid_ItemCreated Method code change
    if (!(e.Item.DataItem is GridInsertionObject))
        _participantList.SelectedValue =
            ((Participant) (e.Item.DataItem)).ID.ToString();
        // I added this line
        _participantList.Text = ((Participant)(e.Item.DataItem)).ID.ToString();
    if (e.Item.DataItem is GridInsertionObject)
        _participantList.EmptyMessage = "-- Select --";

  5. Sandy
    Sandy avatar
    26 posts
    Member since:
    Mar 2012

    Posted 05 Mar 2012 Link to this post

    I am using the Rad ComboBox.The Selected index changed event is triggering when I select single index.if I select Multiple indexes the selected index changed property is not firing.Could you guys please help me on this.
    Thank you,
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Mar 2012 Link to this post


    I tried to reproduce the problem, but no avail. Here is the sample code that i tried which worked for me.
    <telerik:RadComboBox ID="radcombobox1" runat="server" AutoPostBack="true" AllowCustomText="true" MarkFirstMatch="true"  AutoCompleteSeparator="," onselectedindexchanged="radcombobox1_SelectedIndexChanged"  >
      <telerik:RadComboBoxItem Text=" item1" Value="" />
      <telerik:RadComboBoxItem Text="item2" Value="" />
      <telerik:RadComboBoxItem Text="item3" Value="" />
      <telerik:RadComboBoxItem Text="item4" Value="" />
      <telerik:RadComboBoxItem Text="item5" Value="" />
      <telerik:RadComboBoxItem Text="item6" Value="" />
      <telerik:RadComboBoxItem Text="item7" Value="" />
    Also take a look into the following documentation.

  7. Jaspal
    Jaspal avatar
    4 posts
    Member since:
    May 2015

    Posted 28 May 2015 Link to this post



    <telerik:RadComboBox ID="ddldropdwon" runat="server" Width="35px" ViewStateMode="Inherit" AutoPostBack="false" RenderMode="Lightweight" HighlightTemplatedItems="true" OnSelectedIndexChanged="ddldropdwon_SelectedIndexChanged">



    public void ddldropdwon_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
                RadComboBox combo = sender as RadComboBox;
                GridDataItem item = (GridDataItem)combo.NamingContainer;
                int index = item.ItemIndex;
                //((CheckBox)gvDetail.Items[index].FindControl("ChkChecked")).Checked = true;


Back to Top