Hi,
I am facing a problem while trying to insert checkbox control into the cell during the itemdatabound event. The grid is tied to the datatable which is created dynamically.
This is the code:
Protected Sub gvCompareAccessories_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvCompareAccessories.ItemDataBound
If (e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item) Then
'If TypeOf e.Item Is GridDataItem Then
Dim dt As GridDataItem = DirectCast(e.Item, GridDataItem)
'Dim imgbox As System.Web.UI.WebControls.Image = New System.Web.UI.WebControls.Image()
If (e.Item.RowIndex = 2) Then
Dim plcholder As PlaceHolder = New PlaceHolder()
Dim chkbox As CheckBox = New CheckBox()
For Each cellitem As GridTableCell In e.Item.Cells
chkbox.Text = "Remove"
plcholder.Controls.Add(chkbox)
cellitem.Controls.Add(plcholder)
Next
End If
End If
End Sub
Here in the code i am trying to insert the checkbox into each cell of row index 2. But the checkbox appears only in the last column.
I am facing a problem while trying to insert checkbox control into the cell during the itemdatabound event. The grid is tied to the datatable which is created dynamically.
This is the code:
Protected Sub gvCompareAccessories_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvCompareAccessories.ItemDataBound
If (e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item) Then
'If TypeOf e.Item Is GridDataItem Then
Dim dt As GridDataItem = DirectCast(e.Item, GridDataItem)
'Dim imgbox As System.Web.UI.WebControls.Image = New System.Web.UI.WebControls.Image()
If (e.Item.RowIndex = 2) Then
Dim plcholder As PlaceHolder = New PlaceHolder()
Dim chkbox As CheckBox = New CheckBox()
For Each cellitem As GridTableCell In e.Item.Cells
chkbox.Text = "Remove"
plcholder.Controls.Add(chkbox)
cellitem.Controls.Add(plcholder)
Next
End If
End If
End Sub
Here in the code i am trying to insert the checkbox into each cell of row index 2. But the checkbox appears only in the last column.