How to bind radcombobox inside rad grid?

4 posts, 0 answers
  1. Tzach Kaufmann
    Tzach Kaufmann avatar
    95 posts
    Member since:
    Aug 2008

    Posted 05 Jun 2014 Link to this post

    Here is my grid:

                    <telerik:RadGrid ID="gvWebUsers" runat="server" 
                        <ClientSettings Resizing-AllowColumnResize="true" Resizing-ClipCellContentOnResize="true" />
                        <MasterTableView DataKeyNames="UserID" PageSize="15" EditMode="InPlace" >
                            <PagerStyle Mode="NextPrevAndNumeric" />
                                 <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="<%$ Resources:English,Settings_MobilityUsers_Email %>"
                                    UniqueName="EmailAddress" ReadOnly="True" />
                                 <telerik:GridBoundColumn DataField="FirstName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_FirstName %>"
                                    UniqueName="FirstName" ReadOnly="True" />
                                 <telerik:GridBoundColumn DataField="LastName" HeaderText="<%$ Resources:English,Settings_MobilityUsers_LastName %>"
                                    UniqueName="LastName" ReadOnly="True" />
                                 <telerik:GridBoundColumn DataField="IsDomainUser" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsDomainUser %>"
                                    UniqueName="IsDomainUser" ReadOnly="True" />
                                 <telerik:GridBoundColumn DataField="IsVerified" HeaderText="<%$ Resources:English,Settings_MobilityUsers_IsVerified %>"
                                    UniqueName="IsVerified"  ReadOnly="True"/>
                                 <telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="BlockButton" />
                                 <telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="ChangePassButton" />

                                <telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="AllowUploadButton" />
                                 <telerik:GridButtonColumn HeaderStyle-Width="80px" ItemStyle-Width="80px" ButtonType="LinkButton" UniqueName="UnlockButton" />

                        <telerik:GridTemplateColumn HeaderText="Category" ItemStyle-Width="240px">
                                <%#DataBinder.Eval(Container.DataItem, "IsUploadAllowed")%>
                                <telerik:RadComboBox runat="server" ID="RadComboBox2" skin="Gray">

                        <telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
                            HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">


    I try to bind data from server side as suggested in your posts:

        protected void gvWebUsers_ItemDataBound(object sender, GridItemEventArgs e)
             if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                GridEditableItem editItem = (GridEditableItem)e.Item;
                RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox2");
                combo.DataSource = GetUploadStatus();
                combo.DataTextField = "Key";
                combo.DataValueField = "Value";

    But it never enters into the "if" statement (there is no GridEditableItem)
    what am I doing wrong??
  2. Eyup
    Eyup avatar
    2941 posts

    Posted 10 Jun 2014 Link to this post

    Hello Tzach,

    Can you please verify that you are opening the row in edit mode so the e.Item.IsInEditMode returns true to pass the condition?

    I am also sending a sample RadGrid web site to demonstrate how you can bind the combo using its own DataBinding event. Please run the attached application and let me know if it helps you.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. Artur
    Artur avatar
    6 posts
    Member since:
    Apr 2016

    Posted 28 Apr in reply to Eyup Link to this post


    Eyup, I have fit your solution in my project, but for some reason the OnDataBinding event is being triggered infinite times and the same query is being sent to the database. Am I missing something? Here's my code.


    <telerik:GridBoundColumn UniqueName="GradeCode" DataField="GradeCode" HeaderText="Grade Code">
            <telerik:RadComboBox ID="RadComboBox2" runat="server" AppendDataBoundItems="true" OnDataBinding="RadComboBox2_DataBinding"
                    <telerik:RadComboBoxItem Text="Select" />

    code behind

    private void DropBoxBindData(RadComboBox dropDownList)
        using (var myContext = new TelerikWebApp1.App_Code.UkConverterEntities())
            var gradeCode = myContext.Northgates.Select(m => m.GradeCode).Distinct().ToList();
            dropDownList.DataSource = gradeCode;
    protected void RadComboBox2_DataBinding(object sender, EventArgs e)
        RadComboBox combo = sender as RadComboBox;
        combo.DataTextField = "GradeCode";
        combo.DataValueField = "GradeCode";

  5. Eyup
    Eyup avatar
    2941 posts

    Posted 03 May Link to this post

    Hi Artur,

    Remove the dropDownList.DataBind(); line. In this case this method is called internally automatically by the parent IBindingContainer.

    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top