Bind to template column problem

3 posts, 1 answers
  1. Steve
    Steve avatar
    4 posts
    Member since:
    Aug 2015

    Posted 07 Apr Link to this post

    I'm trying to bind to a templated column with a radDropDownList control in it. I am using editmode=batch on the grid. So when editing no events are fired server side.

    How do I go about binding to the dropdownlist when the grid is populated server side. I tried binding to the dropdownlist when the grid is built server side in the itemdatabound event but the e.Item.FindControl("radddlParameterId") does not find the control.

    I want the grid to show text and then when edited switch to the populated dropdownlist that the user can select from.

    Thanks,

    Steve

  2. Answer
    Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 12 Apr Link to this post

    Hello Steve,

    Please note that Batch editing mode is different than other modes. You can find a detailed explanation in the following section:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-batch-edit-mode


    You can check the following live sample:
    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

    If you need to implement more complex template configuration, you can use:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/working-with-templates

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    4 posts
    Member since:
    Aug 2015

    Posted 14 Apr in reply to Eyup Link to this post

    Thanks Eyup. The live sample led me in the right direction. What I was looking for was this:

    Protected Sub radgrdTableColumns_PreRender(sender As Object, e As EventArgs)

             Dim objParameterDropList As RadDropDownList = DirectCast(radgrdTableColumns.MasterTableView.GetBatchEditorContainer("Parameter_Id").Controls(1), RadDropDownList)
             Dim objParameterDs As DataSet
             objParameterDs = m_objDb.GetParameters()
             If objParameterDs IsNot Nothing AndAlso objParameterDs.Tables IsNot Nothing Then
                objParameterDropList.DataValueField = "Parameter_Id"
                objParameterDropList.DataTextField = "Description"
                objParameterDropList.DataSource = objParameterDs.Tables(0)
                objParameterDropList.DataBind()
             End If

    end Sub

Back to Top