Professional Web Applications Themes

Back to previous page . . . - ASP.NET General

Hi. I'd like to put a button on my ASP.NET pages that sends them back to the previous page (as opposed to them having to use the browser back button). I can think of two ways to do this: (i) Use Javascript "window.history.back();" function (ii) Harcode the back button as a link button pointing to a page where I know it came from (due to the architecture of the site). Firstly, where would I code this javascript in ASP.net? Should I do it from the design view HTML tab, or somehow attach it to an event handler for the button? ...

  1. #1

    Default Back to previous page . . .

    Hi.

    I'd like to put a button on my ASP.NET pages that sends them back to the
    previous page (as opposed to them having to use the browser back button).

    I can think of two ways to do this:

    (i) Use Javascript "window.history.back();" function

    (ii) Harcode the back button as a link button pointing to a page where I
    know it came from (due to the architecture of the site).

    Firstly, where would I code this javascript in ASP.net? Should I do it from
    the design view HTML tab, or somehow attach it to an event handler for the
    button? I am assuming the first, a code example would be handy . . .!

    Second, Doing it with javascript probably wont fly for this app, as I have
    to support PDAs, and this requires HTML 3.2 which doesn't have Javascript.
    So I guess I have to go with the second option . . .

    But the second option loses the history on the page it came from.

    Any suggestions?

    Lauchlan M


    Lauchlan Guest

  2. #2

    Default Re: Back to previous page . . .

    The problem with the JavaScript solution is that ASP.Net pages Post Back to
    themselves. You can never be certain WHERE the "back()' function is going to
    take you, and of course, you will get those "This page must be reloaded"
    messages in your browser. It would be better to keep track on the server of
    what the last page viewed was, and use that.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Lauchlan M" <com> wrote in message
    news:phx.gbl... 
    from 


    Kevin Guest

  3. #3

    Default Re: Back to previous page . . .

    > The problem with the JavaScript solution is that ASP.Net pages Post Back
    to 
    to 
    of 

    Ta


    Lauchlan Guest

Similar Threads

  1. HELP! -- previous page in VB and ASP 3.0
    By segis bata in forum ASP Components
    Replies: 4
    Last Post: September 28th, 12:06 PM
  2. Login redirect back to previous page
    By Glen T in forum Coldfusion Database Access
    Replies: 2
    Last Post: September 18th, 11:33 PM
  3. Replies: 2
    Last Post: October 28th, 02:07 PM
  4. "back" and return to previous place script?
    By Rob Dillon in forum Macromedia Director Basics
    Replies: 5
    Last Post: September 5th, 07:26 PM
  5. Replies: 1
    Last Post: September 5th, 10:09 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139