I want my datagrid rows to be clickable, so that a button column is
fired when my user clicks anywhere on a row. Using Google, I figured out
how to do it, but it only works after row 8. From row 9 on, the next
page opens properly, but clicking rows 1 through 8 does nothing - the
dopostback fires, but the page does not change. If I remove this code,
the button column works fine. This sub seems to be disabling rows 1-8
for some reason.
Here's my sub:
Protected Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
e.Item.Attributes.Add("onclick",
"javascript:__doPostBack('dgrDataGrid$ctl" & _
(e.Item.ItemIndex + 2) & _
"$ctl00','')")
end sub
fired when my user clicks anywhere on a row. Using Google, I figured out
how to do it, but it only works after row 8. From row 9 on, the next
page opens properly, but clicking rows 1 through 8 does nothing - the
dopostback fires, but the page does not change. If I remove this code,
the button column works fine. This sub seems to be disabling rows 1-8
for some reason.
Here's my sub:
Protected Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
e.Item.Attributes.Add("onclick",
"javascript:__doPostBack('dgrDataGrid$ctl" & _
(e.Item.ItemIndex + 2) & _
"$ctl00','')")
end sub