Adding custom columns to datagrids May 04 2004
I came across this problem of adding a custom image column to my datagrid any time the unique row type changed. Since datagrid did not support
asp:image at run time, I needed to add the cell as the data was binding
=== BEGIN ===
Private Sub dgInodeList_OnItemDataBoundEventHandler( _
ByVal sender As System.Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles dgInodeList.ItemDataBound
….
Dim cell As New TableCell
Dim img As New System.Web.UI.WebControls.Image
If (inode_type_name = “DIRECTORY”) Then
img.ImageUrl = “image/explorer_folder.jpg”
ElseIf (inode_type_name = “FILE”) Then
img.ImageUrl = “image/explorer_file.jpg”
End If
cell.Controls.Add(img)
e.Item.Cells.Add(cell)
…
end sub
=== END ===
- Posted in : .NET
- Author : site admin

Comments»
no comments yet - be the first?