Newbie needs help on messagebox

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
 
E

Eliyahu Goldin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top