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

Cannot populate RadComboBox in RadGrid

1 Answer 48 Views
This is a migrated thread and some comments may be shown as answers.
Judith Murgia
Top achievements
Rank 1
Judith Murgia asked on 11 Aug 2010, 05:32 AM

I have the following grid, all the  GridBoundColumn's populate when the grid is loaded but the radcombobox does not. How can I get it to display the current value?  Does anyone have an example of a radgrid where one of the columns is a drop down or combo box?


Thanks for any help in advance,


<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                <telerik:AjaxUpdatedControl ControlID="Label1" />
    OnItemDataBound = "RadGrid1_ItemDataBound"
        <telerik:GridBoundColumn UniqueName="CategoryID" DataField="CategoryID" HeaderText="CategoryID" ReadOnly="True" >
            <HeaderStyle Width="10%" />
        <telerik:GridBoundColumn UniqueName="checklistNo" DataField="checklistNo" HeaderText="checklistNo"  Display="False" ReadOnly="True" >
            <HeaderStyle Width="25%" />
        <telerik:GridBoundColumn UniqueName="Related_item_type_label" DataField="Related_item_type_label" HeaderText="Question"  ReadOnly="True">
            <HeaderStyle Width="30%" />
        <telerik:GridBoundColumn UniqueName="Service_impact_category" DataField="Service_impact_category" ReadOnly="True" HeaderText="Service Impact" >
            <HeaderStyle Width="10%" />
         <telerik:GridTemplateColumn UniqueName="Inspection Result" DataField="INSPECTION_RESULT" HeaderText="Inspection Result">
            <HeaderStyle Width="17%" />   
            <ItemStyle Width="17%" />
               <telerik:RadTextBox Visible="False" AutoPostBack="true" ID="lblInspectionResult" runat="server"  Text='<%#Eval("INSPECTION_RESULT")%>'>
               <telerik:RadComboBox visible="True" ID="cbInspectionResult" AppendDataBoundItems="true" runat="server"  DataTextField="INSPECTION_RESULT" DataValueField="INSPECTION_RESULT">
        <telerik:GridBoundColumn UniqueName="Inspection_Fault" DataField="Inspection_Fault" HeaderText="Fault" >
            <HeaderStyle Width="10%" />
        <telerik:GridBoundColumn UniqueName="inspection_comment" DataField="inspection_comment" HeaderText="Comments" >
            <HeaderStyle Width="10%" />
            OnCommand="GridCommand" />


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 16 Aug 2010, 10:58 AM
Hi Judith,

You need to bind the combo either declaratively through a data source control, or in RadGrid's ItemDataBound event. You use the same event for setting the SelectedValue of the combo:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        GridEditableItem editItem = (GridEditableItem)e.Item;
        RadComboBox cbInspectionResult = (RadComboBox)editItem["Inspection Result"].FindControl("cbInspectionResult");
        //assuming the owner table has the same data source as the combo
        cbInspectionResult.DataSource = e.Item.OwnerTableView.DataSource;
        cbInspectionResult.SelectedValue = DataBinder.Eval(e.Item.DataItem, "INSPECTION_RESULT").ToString();

All the best,
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
Asked by
Judith Murgia
Top achievements
Rank 1
Answers by
Telerik team
Share this question