Results 1 to 2 of 2

Thread: Response.redirect and anchors

  1. #1

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Response.redirect and anchors

    I have an anchor near the bottom of a page just before a placeholder where error messages are displayed. After the Error message is placed in the placeholder i want the page to go to that anchor.

    VB Code:
    1. 'Spamming so do this!
    2.             turnControlsOff()
    3.             connection.connect(Application("SQLServerAddress"), objConn)
    4.             messages.DisplayMessage(plhMessage, 12)
    5.             Session("returning") = True
    6.             connection.Disconnect(Application("SQLServerAddress"), objConn)
    7.             Response.Redirect("msgboard_topic.aspx#Error")

    In the above code messages.displayMessage places a label with an error message into a placeholder, without using the response.redirect the Error message is displayed and is persistent during refreshes and stays in place if i manually enter msgboard_topic.aspx#Error in the url address bar.

    But when i try and use response.redirect the page moves to the anchor but the message isn't displayed.

    Any ideas?

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    It's doing that because Response.Redirect is reloading the page.
    Perhaps use inline javascript:

    Code:
    <%
                turnControlsOff()
                connection.connect(Application("SQLServerAddress"), objConn)
                messages.DisplayMessage(plhMessage, 12)
                Session("returning") = True
                connection.Disconnect(Application("SQLServerAddress"), objConn)
    %>
    <script language="javascript" type="text/javascript">
        window.location.hash = "Error";
    </script>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width