#1
  1. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2005
    Posts
    67
    Rep Power
    11

    Pop-up message/alert in page load event...


    Ok guys, i need to pick your brains again...

    Here's what i'm trying to do:
    I'm creating a feature on my website(www.grimmusic.com) to allow users to request that other members meet them at specified locations, eg: the forums, the chat room, their profile, etc. I'm making it to where when they request this, it will put a value in a feild in the DB reflecting which user is being requested, and where they're requested to go, then by which member the request was made. When the REQUESTED member visits their next page, in the page load event it will check the DB to see if those feilds have a value, and if so, send a pop-up window giving the user options, eg; 1: "i'll be there in a minuite", 2: "i'm busy at the moment, maybe later", 3: "no thanks". Then, it will gather the value, and send the person making the request it's result in their next page load. Peice of cake...

    Here's what i need to know:
    I want to know if there's a way, with vb syntax(hopeully), to have a message box, or preferably a browser window, pop-up when the user triggers the page load event. I know that in the old VB for applications it was simple, but i only worked with VB for apps for 2 weeks when i went straight to asp.net, and i've only been doing that for about 4 months. Is it possable to have a browser pop-up window, or even a vb style pop-up, which can return a result to the server, WITHOUT using java? I only know VB.net, but if it's simple enough, i can figure out the syntax needed for C#, but i'm not ready for java yet.

    As always, thanks very much for your time.

    ALEX GRIM
  2. #2
  3. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    659
    you can use the RegisterStartupScript to call the javascript alert box or just open a new window with the message in it.

    Example:
    Code:
    Public strMessage As String
    
    Protected Sub Page_Load(blah, blah)
       If blnPersonHasAMessage = True Then
          strMessage = "<script>alert('You have a message.');</script>"
          Page.RegisterStartupScript("ClientScript", strMessage)
       End If
    End Sub

    Comments on this post

    • ALEX_GRIM agrees : this is the first half of exactly what i needed.
    Last edited by Memnoch; July 23rd, 2005 at 10:21 AM.
  4. #3
  5. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2005
    Posts
    67
    Rep Power
    11
    OK, what does this line actually DO: Page.RegisterStartupScript("ClientScript", strMessage)

    because i tried that small "alert" script, and it gave a sufficient little pop-up without the "RegisterStartupScript" part, so i think i messed what you were telling me that was for, but i did catch the rest, ad it was pretty much exactly what i was needing the syntax for, so thanks for that.

    i'm going to google the Page.RegisterStartupScript function, but judging by the way you used it, i'm guessing it's to tell the server that it is to be run on the browser, and not the server?

    oh yeah, i almost forgot the second part of it. is there a way to gather a returned value from this? even if it's something as simple as acknowleging that the user has clicked "OK" instead of closing out the box? or to have a decicion, eg, "yes/no", sort of like the old VB "vbyesno, vbok, vbretry" etc.
    thanks again.
  6. #4
  7. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    Location
    In hell, where did you think?
    Posts
    12,026
    Rep Power
    659
    you can use the javascript "confirm" method to display "OK" and "Cancel" buttons.
  8. #5
  9. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2005
    Posts
    67
    Rep Power
    11
    Thanks a lot for your help, now that i know what to look for, i will find some place to learn that stuff.
    thanks again.

Similar Threads

  1. Load page...Wait...Execute method
    By kboek in forum .NET Development
    Replies: 8
    Last Post: June 24th, 2005, 12:02 PM
  2. "this page cannot be displayed" with no click event
    By jobo in forum .NET Development
    Replies: 1
    Last Post: June 10th, 2005, 04:03 PM
  3. Problem: Different Screen Resolutions Load my web page differently!!!
    By yarman in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: February 5th, 2005, 05:32 PM
  4. Replies: 3
    Last Post: August 22nd, 2004, 07:22 AM
  5. Order in which items load on page
    By chabuhi in forum .NET Development
    Replies: 2
    Last Post: August 20th, 2004, 12:18 PM

IMN logo majestic logo threadwatch logo seochat tools logo