Hi,
I have dynamical RadGrid, GridTemplateColumn is making by MyTemplate class:
Columns create code:
There I try to FindControl.
Can anybody help me?
I have dynamical RadGrid, GridTemplateColumn is making by MyTemplate class:
Public Class MyTemplate |
Implements ITemplate |
Protected boolValue As CheckBox |
Protected tBox As TextBox |
Private colname As String |
Private isHeader As Boolean |
Private columnId As String |
Public Sub New(ByVal cName As String, ByVal header As Boolean, ByVal id As String) |
MyBase.New() |
colname = cName |
isHeader = header |
columnId = id |
End Sub |
Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn |
If isHeader Then |
boolValue = New CheckBox |
boolValue.ID = colname.ToString |
boolValue.Text = colname |
boolValue.Enabled = True |
boolValue.AutoPostBack = True |
boolValue.Checked = True |
container.Controls.Add(boolValue) |
Else |
boolValue = New CheckBox |
boolValue.ID = columnId |
AddHandler boolValue.DataBinding, AddressOf Me.boolValue_DataBinding |
boolValue.Enabled = True |
boolValue.Checked = False |
tBox = New TextBox |
AddHandler tBox.DataBinding, AddressOf Me.tBox_DataBinding |
container.Controls.Add(boolValue) |
container.Controls.Add(tBox) |
End If |
End Sub |
End Class |
Columns create code:
For Each row As DataRow In Services_Table.Rows |
Dim templatecolumn As New GridTemplateColumn |
templatecolumn.UniqueName = row(0) |
templatecolumn.HeaderTemplate = New BeSkaitikliuTemplate(row(1), True, row(0)) |
templatecolumn.ItemTemplate = New BeSkaitikliuTemplate(row(1), False, row(0)) |
PriskirimasRadGrid.Columns.Add(templatecolumn) |
Next |
There I try to FindControl.
For Each GridColumn As GridColumn In PriskirimasRadGrid.MasterTableView.Columns |
For Each item As GridDataItem In PriskirimasRadGrid.MasterTableView.Items |
Dim cBox As CheckBox = CType(item.FindControl(GridColumn.UniqueName), CheckBox) |
Next |
Next |
Can anybody help me?