RadGrid/DDL not Binding using L2S

2 posts, 0 answers
  1. TommyBoy
    TommyBoy avatar
    22 posts
    Member since:
    Oct 2011

    Posted 07 Apr 2013 Link to this post


    RadControls version


    .NET version 4.5
    Visual Studio version 2012
    programming language c#
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION                                    

    I am using a RadGrid with a RadComboBox within a GridTemplateColumn as such:


    <telerik:GridTemplateColumn HeaderText="State" EditFormColumnIndex="2">
            <%#DataBinder.Eval(Container.DataItem, "State")%>
            <telerik:RadComboBox ID="selectState" runat="server" Skin="Web20" DataTextField="stateName" DataValueField="stateCode" />

    I am Databinding using L2S like so:
    protected void RadGrid1_EditCommand(object source, GridCommandEventArgs e)
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)
             GridEditableItem edititem = (GridEditableItem)e.Item;
             DropDownList ddlStates = (DropDownList)edititem.FindControl("selectState");
             ddlStates.DataSource = DbContext.States;
             ddlStates.DataTextField = "stateName";
             ddlStates.DataValueField = "stateCode";

    When I run the project, the state bound item is correctly dispayed however once i edit the record, the RadComboBox does not bind to the data source. No errors are generated. Is it possible that the RadGrid1_EditCommand routine is not firing? Is it my data binding method. DbContext.States is derived from a Class Library project attached to this project.

    Assistance would be helpful.
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 10 Apr 2013 Link to this post

    Hello Tom,

    Please note that the CodeLibrary type of tickets are for our customers to send their suggestions for useful projects that could be uploaded as code libraries in our site. For any issues related to our controls please open a regular support ticket or start a forum thread so that we could address your issue accordingly.

    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top