Newbie needs help on messagebox

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I've seen lots of messages about how to get a confirmation messagebox to
happen before running a piece of code. I need to have a messagebox that does
the typical 'Everything is done.' after I've run some VB code.

Here's the code snippet:

In my .aspx page:
<asp:linkbutton id="btnDeleteGroup" runat="server"
onclick="btnDeleteGroup_Click">Delete Group</asp:linkbutton>

In my page load function:
Me.btnDeleteGroup.Attributes.Add("onclick", "javascript:if (confirm('Do
you really want to this group?')== false) return false;")

In my code file, there's a function:

Protected Sub btnDeleteGroup_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

<do some stuff....>

' Need to display a 'All done' message to the user.

end sub
 
Use a hidden input to pass message strings from server to client. On the
client handle body's onload event. In the event handler check the input. If
it is not empty, call alert() to produce a messagebox with the message.

BTW, here is an improvement to your code:
Me.btnDeleteGroup.Attributes.Add("onclick", "return confirm('Do you really
want to this group?');")

Eliyahu
 
Back
Top