Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: Delete confirm


Message #1 by "Mingkun Goh" <mangokun@h...> on Sat, 7 Dec 2002 14:33:45
Using its Attributes collection to add an attribute for the onClick of the 
Button:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load
        btnDelete.Attributes.Add("onClick", "return confirm('Are you sure 
you wish to delete this item?');")
    End Sub

For the delete button's onClick event:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnDelete.Click
        ' Do something here
    End Sub


Now, when we click on our delete button, we'll get a confirmation dialog 
box asking if we are sure we want to delete the item.


I learned this from an online article:

DotNetJunkies.com - How To Add a Delete Confirmation to a DataGrid
http://www.dotnetjunkies.com/howto/default.aspx?id=32


Similar Threads in p2p.wrox.com - aspx
Re: MessageBox in aspx
http://p2p.wrox.com/archive/aspx/2002-07/64.asp


Previous message:
> Hi, I'm new in town, and I want to confirm record deletion in an aspx 
p> age. When the user press the delete button, he should get a dialog box 
c> onfirming deletion, if he press "Yes" then the delete code on the 
server 
w> ill execute, otherwise nothing should happen (no post to server is 
r> equired).
A> ny hints?!
Message #2 by "B.VENKATESHWAR RAO" <BVRAO9@H...> on Tue, 10 Dec 2002 12:12:00
Hi friend,
i am also in the same problem, if i get i will send or if you get you 
please send in this.
bye

Message #3 by "B.VENKATESHWAR RAO" <BVRAO9@H...> on Tue, 10 Dec 2002 12:33:35
Hi ,i tried using javascript but it is not accepting because i already 
used C#  lanuage in my page,so please give another alternative
thanks


  Return to Index