PLEASE HELP.... ALERT PostBack

Discussion in 'ASP .Net Web Controls' started by walterd, Apr 22, 2004.

  1. walterd

    walterd Guest

    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!!!!
     
    walterd, Apr 22, 2004
    #1
    1. Advertising

  2. 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
    = '';");
    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "walterd" <> wrote in message
    news:...
    > 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!!!!
    >
    >
    >
    >
     
    Alvin Bruney [MVP], Apr 22, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John sorCrer
    Replies:
    1
    Views:
    747
    Alvin Bruney [MVP]
    Mar 4, 2004
  2. gce
    Replies:
    2
    Views:
    1,740
  3. KK
    Replies:
    2
    Views:
    711
    Big Brian
    Oct 14, 2003
  4. Mersh
    Replies:
    0
    Views:
    524
    Mersh
    Mar 13, 2007
  5. Ganesh
    Replies:
    0
    Views:
    585
    Ganesh
    Jun 29, 2007
Loading...

Share This Page