SqueakinSweep
Programmer
Hi all..
I have a delete command button in a datagrid. I can successfully bind the delete button to the "onclick" event, but would like to use a VBScript confirmation in the form of a MessageBox - Ok to Delete Yes/No. I can use the Javascript confirm command successfully, but am unsure if VBScript Messagebox can serve the same purpose. Regardless of whether I click Yes or No, the Datagrids Deletecommand is fired.
Sweep
...if it works dont mess with it
I have a delete command button in a datagrid. I can successfully bind the delete button to the "onclick" event, but would like to use a VBScript confirmation in the form of a MessageBox - Ok to Delete Yes/No. I can use the Javascript confirm command successfully, but am unsure if VBScript Messagebox can serve the same purpose. Regardless of whether I click Yes or No, the Datagrids Deletecommand is fired.
Code:
Private Sub xGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles xGrid.ItemDataBound
If e.Item.ItemType = ListItemType.Header Or e.Item.ItemType = ListItemType.Footer Then Exit Sub
Dim deleteButton As LinkButton = e.Item.Cells(0).Controls(0)
'JavaScript Confirm which works!
'deleteButton.Attributes("onclick") = "javascript:return " & _
' "confirm('Are you sure you want to delete PIECE #" & _
' DataBinder.Eval(e.Item.DataItem, "MARK") & "?')"
'This is the VB Script bit I want to get to work!!
deleteButton.Attributes("onclick") = "vbscript:return " & _
"MsgBox('Delete?', vbYesNo)"
End Sub
Sweep
...if it works dont mess with it