No alert message showing

Last post 06-23-2009 10:19 AM by ChaitanyaC. 2 replies.

Sort Posts:

  • No alert message showing

    06-23-2009, 6:09 AM
    • Member
      10 point Member
    • salicylate8
    • Member since 06-01-2009, 7:37 AM
    • Posts 11

     Hi,

     I would like to show alert message once return value is clear then it only will redirect to GameListing.aspx page, but there is no alert mesage out at all. any idea? thank you  

    Code in aspx.vb

    If (return_value = "clear") Then               
             ClientScript.RegisterClientScriptBlock(Page.GetType, "Script", "<script language='javascript'>alert('Please follow up data in form');</script>")
              Response.Redirect("GameListing.aspx?product_id=" + Request.QueryString("product_id"))
    End If

  • Re: No alert message showing

    06-23-2009, 7:41 AM
    Answer

    Two issues: first of all, you need to use RegisterStartupScript (instead of RegisterClientScriptBlock) for the alert to show "automatically".  But the bigger issue, is that in the code behind you redirect to a different page, so the alert will never show.  Maybe change your code to include a window.location=blahblah, after the code for the alert.  Which means that after the user clicks OK, the page gets redirected to GameListings.aspx.  Something like that...

  • Re: No alert message showing

    06-23-2009, 10:19 AM
    Answer
    • Member
      636 point Member
    • ChaitanyaC
    • Member since 06-06-2009, 12:30 AM
    • Mumbai
    • Posts 94

    Try to use following:

     Dim scriptStr As New System.Text.StringBuilder
            scriptStr.Append("<script language='javascript'>alert('Please follow up data in form');")
            scriptStr.Append("window.location='"GameListing.aspx?product_id=" + Request.QueryString("product_id")'; </script>")
            If Not Page.ClientScript.IsStartupScriptRegistered("PopupScriptWithLoc") Then
                Me.ClientScript.RegisterStartupScript(Me.GetType(), "PopupScriptWithLoc", scriptStr.ToString(), False)
            End If

    ** Mark any post that really helps you as “ANSWER” to indicate all other viewers in future for reference; **
    Thnks,
Page 1 of 1 (3 items)