Hi
I'm dynamically adding buttons in datagrid cells on the itemdatabound function. I'm also trying to determine which column I'm in and pull out the headertext of that column.
This is what I've got so far
Private Sub dgData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgData.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.SelectedItem Then
If e.Item.Cells(i).Text = "Book" Then
btn = New Button
btn.Text = "Book"
btn.ID = "Btn-" & i '& Add the columnheader
btn.CssClass = "btn"
AddHandler btn.Click, AddressOf btn_Click
e.Item.Cells(i).Controls.Add(btn)
end if
end if
any help would be greatly appreciated
lbob
I'm dynamically adding buttons in datagrid cells on the itemdatabound function. I'm also trying to determine which column I'm in and pull out the headertext of that column.
This is what I've got so far
Private Sub dgData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgData.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.SelectedItem Then
If e.Item.Cells(i).Text = "Book" Then
btn = New Button
btn.Text = "Book"
btn.ID = "Btn-" & i '& Add the columnheader
btn.CssClass = "btn"
AddHandler btn.Click, AddressOf btn_Click
e.Item.Cells(i).Controls.Add(btn)
end if
end if
any help would be greatly appreciated
lbob