PLEASE HELP.... ALERT PostBack

W

walterd

Hi All

Can someone please help me before I pull out all my hair? All my pages
inherit from PageBase class and I have the following code:

Public Shared Function CreateMessageAlert(ByRef aspxPage As
System.Web.UI.Page, ByVal strMessage As String, ByVal strKey As String)

Dim strScript As String = "<script language=JavaScript>alert('" & strMessage
& "')</script>"

If (Not aspxPage.IsStartupScriptRegistered(strKey)) Then

aspxPage.RegisterStartupScript(strKey, strScript)

End If

End Function

My problems is:

1. When I call the following function from an, say exception or
notification, the MessageBox appears on a BLANK Page, after clicking OK, the
page where the MessageBox was invoked from is displayed. It never displays
on the current page :({

2. If I want to display a message and upon clicking OK, redirect the page to
another, the MessageBox never appears. Page redirect will happen and no
message will appear :((

PLEASE HELP!!!!
 
A

Alvin Bruney [MVP]

just go ahead and pull your hair out...it aint worth it

....now that you are bald, let's take a look. if you want the message box to
appear ontop of the page, either use registerstartupscript or replace the
response.write portion to Page.Controls.Add(new LiteralControl("<script...


use attributes to post on condition. modify this code to post

Button1.Attributes.Add("onClick", "event.returnValue=confirm('Are you sure
you wish to delete the selected rate
deck?');document.body.style.cursor='wait';document.all.WaitState.style.display
= '';");
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top