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

How to fill a comboBox in hierarchical grid

2 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cecilie Nordbø
Top achievements
Rank 1
Cecilie Nordbø asked on 11 May 2011, 01:00 PM
Hi.
How can i fill a combobox with values in insert-/editmode when i have a hierarchical grid for the detailtable?

Ceci

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 May 2011, 01:30 PM
Hello Cecilie,
Try the following code snippet.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "Detail1")
       {
           RadComboBox combo = (RadComboBox)e.Item.FindControl("Combobox1");
           combo.DataSource=//set the data source here.
       }
   }

aspx:
<DetailTables>
      <telerik:GridTableView Name="Detail1" DataSourceID="SqlDataSource2" runat="server"  AllowPaging="true"
                        PageSize="2" AutoGenerateColumns="false" DataKeyNames="EmployeeID">
          <Columns>
             <telerik:GridEditCommandColumn>
             </telerik:GridEditCommandColumn>
             <telerik:GridTemplateColumn>
                     <EditItemTemplate>
                  <telerik:RadComboBox ID="Combobox1" runat="server">
                  </telerik:RadComboBox>
                     </EditItemTemplate>
              . . . . . . . . . . . . . . . . . . . . .

Thanks,
Princy.
0
Cecilie Nordbø
Top achievements
Rank 1
answered on 11 May 2011, 02:22 PM
It works
Tags
Grid
Asked by
Cecilie Nordbø
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Cecilie Nordbø
Top achievements
Rank 1
Share this question
or