Something like this should do the trick for you.
<code>
Private Sub TheGrid_ItemDataBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
TheGrid.ItemDataBound
Try
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem,
ListItemType.EditItem, ListItemType.SelectedItem
' change this value to the column value to match that of your datagrid's
column containing the delete linkbutton
Dim intYourCellThatHasTheDeleteLinkButton = 0
Dim lb as LinkButton =
GetLinkButton(e.Item.Cells(intYourCellThatHasTheDeleteLinkButton))
If Not lb Is Nothing Then
' add an onclick attribute that will prompt the user
' if the user selects ok, then the DeleteCommand event will fire.
' if the user selects cancel, then it will not
lb.Addributes.Add("onclick", "return confirm(""Are you sure you want to
delete this record?"");")
End If
End Select
Catch ex As Exception
' Your error handler here
End Try
End Sub
Function GetLinkButton(Cell as TableCell) as LinkButton
For Each ctl As Control In Cell.Controls
If TypeOf(ctl) Is LinkButton Then
Return DirectCast(ctl, LinkButton)
End If
Next
End Function
</code>
HTH
Craig