This question has been posted many times. But still, with all the material available online I don't understand why I cannot make the code below working. Maybe it's because I'm using datalist instead of a datagrid.
Do you see something wrong?
thanks
Do you see something wrong?
thanks
Code:
Private Sub Item_Created_mes(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
' process data rows only (skip the header, footer etc.)
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
' get a reference to the LinkButton of this row,
' and add the javascript confirmation
Dim lbtdeleteMes As LinkButton = CType(e.Item.FindControl("lbtdelete"), LinkButton)
lbtdeleteMes.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this record?');")
End If
End Sub