Something like this should do the trick for you.
<code>
Private Sub TheGrid_ItemDat aBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
TheGrid.ItemDat aBound
Try
Select Case e.Item.ItemType
Case ListItemType.It em, ListItemType.Al ternatingItem,
ListItemType.Ed itItem, ListItemType.Se lectedItem
' change this value to the column value to match that of your datagrid's
column containing the delete linkbutton
Dim intYourCellThat HasTheDeleteLin kButton = 0
Dim lb as LinkButton =
GetLinkButton(e .Item.Cells(int YourCellThatHas TheDeleteLinkBu tton))
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.A dd("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(C ell 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
"Dave" <da*********@ho tmail.com> wrote in message
news:uv******** *****@tk2msftng p13.phx.gbl...
How can I add the confirmation dialog on record delete to the "Delete"
command column in DataGrid control?