Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client Side Delete Confirmation with VB Script

Status
Not open for further replies.

SqueakinSweep

Programmer
Jun 20, 2002
945
GB
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.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top