H
hansiman
When I want to add a js confirm box to a delete button that is
positioned in the last column in a datagrid row I do the following in
the ItemDataBound event:
Dim delBtn As LinkButton = e.Item.Cells(10).Controls(0)
delBtn.Attributes("onclick") = "javascript:return confirm('you
sure?');"
If I want to change an image in a datagrid row I do the following in
the ItemDataBound event:
Dim imgX As System.Web.UI.WebControls.Image =
CType(e.Item.FindControl("imgX"), System.Web.UI.WebControls.Image)
imgX.ImageUrl = "image.gif"
If I add a new column to the grid the reference using the cell number
breaks (e.Item.Cells(10).Controls(0) is now
e.Item.Cells(11).Controls(0)). The reference using the FindControl
method off course still works.
Is there a way to reference the Delete button so that adding new
columns don't break the code?
/M
positioned in the last column in a datagrid row I do the following in
the ItemDataBound event:
Dim delBtn As LinkButton = e.Item.Cells(10).Controls(0)
delBtn.Attributes("onclick") = "javascript:return confirm('you
sure?');"
If I want to change an image in a datagrid row I do the following in
the ItemDataBound event:
Dim imgX As System.Web.UI.WebControls.Image =
CType(e.Item.FindControl("imgX"), System.Web.UI.WebControls.Image)
imgX.ImageUrl = "image.gif"
If I add a new column to the grid the reference using the cell number
breaks (e.Item.Cells(10).Controls(0) is now
e.Item.Cells(11).Controls(0)). The reference using the FindControl
method off course still works.
Is there a way to reference the Delete button so that adding new
columns don't break the code?
/M