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

Binding DropDownList in EditItemtemplate to the Grid column

1 Answer 502 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 20 May 2009, 05:13 AM

I'm trying to use a drop-down list to edit a column in a RadGrid.  The values in the drop-down are pre-determined, as in the example below. When I do this, the DropDownList shows up in the Edit Item template, but when I select a value and save, the value doesn't get saved to the Grid (though a textbox in the same grid does update the grid, so I know everything else is working ok). 

Obviously, the RadGrid doesn't know to bind the selected item from the DropDownList to the "Department" column.  When specifying a DropDownList declaratively like this, how do I bind the selected item to the column in the RadGrid? 

<telerik:GridTemplateColumn UniqueName="Department" HeaderText="Department">  
    <ItemTemplate> 
 <asp:Label ID="DepartmentLabel" runat="server">  
     <%# DataBinder.Eval(Container.DataItem, "Department") %> 
 </asp:Label> 
    </ItemTemplate> 
    <EditItemTemplate> 
 <asp:DropDownList ID="DepartmentDropDown" runat="server">  
     <asp:ListItem Text="Choose a Department" Value="" /> 
     <asp:ListItem Text="100 - Dept A" Value="100 - Dept A" /> 
     <asp:ListItem Text="200 - Dept B" Value="200 - Dept B" /> 
     <asp:ListItem Text="300 - Dept C" Value="300 - Dept C" /> 
     <asp:ListItem Text="400 - Dept D" Value="400 - Dept D" /> 
 </asp:DropDownList> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 
 
 

Regards,
Mike

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 May 2009, 07:04 AM
Hi Mike,

Go through the following help article which explains how to perform operations with MS DropDownList in EditItemTemplate of GridTemplateColumn.
Operations with MS DropDownList in EditItemTemplate of GridTemplateColumn

Shinu
Tags
Grid
Asked by
Mike
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or