Binding DropDownList in EditItemtemplate to the Grid column

2 posts, 0 answers
  1. Mike
    Mike avatar
    6 posts
    Member since:
    Dec 2007

    Posted 20 May 2009 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 May 2009 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top