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

Bind to template column problem

2 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 07 Apr 2016, 10:22 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 12 Apr 2016, 12:23 PM
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.
0
Steve
Top achievements
Rank 1
answered on 14 Apr 2016, 04:34 PM

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

Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Steve
Top achievements
Rank 1
Share this question
or