Query Delete

In my GoWeb application I have a derived class of GoShape. In my class I allow deletion via a context menu. Is there a way to intercept the event in JavaScript that would allow me to prompt for confirmation before perofmring the delete?

Here is the code I'm using:

Public Overrides Function GetContextMenu(ByVal view As GoView) As GoContextMenu<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Try

If TypeOf view Is GoOverview Then

Return Nothing

End If

If Not (TypeOf view.Document Is WSDoc) Then

Return Nothing

End If

Dim myMenu As GoContextMenu = New GoContextMenu(view)

If (CType(view.Document, WSDoc).Editable AndAlso Not Me.ShapeType = Common.WSShapeType.Terminator) Then

myMenu.MenuItems.Add(New MenuItem("Create Link", New EventHandler(AddressOf Me.CreateLink_Command)))

myMenu.MenuItems.Add(New MenuItem("-"))

End If

If CanDelete() Then

myMenu.MenuItems.Add(New MenuItem("Delete", New EventHandler(AddressOf Me.Delete_Command)))

End If

Return myMenu

Catch ex As Exception

Throw New Exception(mcstrMOD & ".GetContextMenu()", ex)

End Try

End Function

Public Sub Delete_Command(ByVal sender As Object, ByVal e As EventArgs)

Try

If TypeOf sender Is MenuItem Then

Dim v As GoView = GoContextMenu.FindView(CType(sender, MenuItem))

v.EditDelete()

End If

Catch ex As Exception

Throw New Exception(mcstrMOD & ".Delete_Command()", ex)

End Try

End Sub

Add the menu with this line:

cm.MenuItems.Add(new GoMenuItem("Delete", "ConfirmDelete()"));
...note it is GoMenuItem, not simply MenuItem...
and then add this script to your page (passing appropriate view Id and event method)
function ConfirmDelete() {
var answer = confirm ("Really Delete?");
if (answer)
goRaiseEvent("MyView", "GraphNode.Delete_Command");
}

Brilliant. Worked perfectly. Thanks mate!

Cheers...