A
Averell
Hi,
I made a gridview with VWD. The gridview has the Delete button set
(ShowDeleteButton="True" in the <asp:CommandField>).
It works perfect, but i would like to add a warning before the record is
deleted to prevent deleting a wrong record.
I did this in the code-behind file:
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles
GridView1.RowDeleting
Dim jv As String
jv = "<script language='javascript'>" _
& " alert('beware!');" _
& "if (! confirm('if you want to delete it, click on OK'));" _
& " {window.location.href='mult.aspx'};" _
& "</script>"
Response.Write(jv)
End Sub
I see effectively the warning, but when i click on OK or on Cancel of the
Confirm, in both cases the record is deleted.
Is it possible to prevent that, and if yes, how?
Thanks for any hints
Averell
I made a gridview with VWD. The gridview has the Delete button set
(ShowDeleteButton="True" in the <asp:CommandField>).
It works perfect, but i would like to add a warning before the record is
deleted to prevent deleting a wrong record.
I did this in the code-behind file:
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles
GridView1.RowDeleting
Dim jv As String
jv = "<script language='javascript'>" _
& " alert('beware!');" _
& "if (! confirm('if you want to delete it, click on OK'));" _
& " {window.location.href='mult.aspx'};" _
& "</script>"
Response.Write(jv)
End Sub
I see effectively the warning, but when i click on OK or on Cancel of the
Confirm, in both cases the record is deleted.
Is it possible to prevent that, and if yes, how?
Thanks for any hints
Averell