Creating a "Back" button in VB.Net/ASP.Net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coleen

    #1

    Creating a "Back" button in VB.Net/ASP.Net

    Yes, I know why would I want to create a back button when there is one on
    the browser? Because that's what the users want! they want a "Previous"
    button that they can click from any web page in our application that will do
    the exact same thing as the Back button in the browser. Can anyone give me
    any suggestions on how to do this using VB .Net? I have Googled for "Create
    Back Button" and found stuff in JavaScript and HTML but nothing in VB .Net.
    Can this be done as simply as doing a response.redire ct? Any help would be
    appreciated.

    Coleen


  • Herfried K. Wagner [MVP]

    #2
    Re: Creating a "Back&quot ; button in VB.Net/ASP.Net

    "Coleen" <coleenholley@y ahoo.com> schrieb:[color=blue]
    > Yes, I know why would I want to create a back button when there is one on
    > the browser? Because that's what the users want! they want a "Previous"
    > button that they can click from any web page in our application that will
    > do
    > the exact same thing as the Back button in the browser. Can anyone give
    > me
    > any suggestions on how to do this using VB .Net? I have Googled for
    > "Create
    > Back Button" and found stuff in JavaScript and HTML but nothing in VB
    > .Net.
    > Can this be done as simply as doing a response.redire ct? Any help would
    > be
    > appreciated.[/color]

    As the action takes place on the client (as does pressing the browser's
    "Back" button) you may want to use client-side JavaScript. Solutions can be
    found on the Web.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Coleen

      #3
      Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

      Yes, I know I can use JavaScript, thanks. I was trying to find out if there
      is a way to do this using VB.Net? I have been reading all the help files
      and searching on-line but can't find anything to accomplish this in VB .Net.
      Is this not supported by .Net? Why is it that things that should be very
      simple are so convoluted in .Net?

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:Oupxe%23rf GHA.764@TK2MSFT NGP05.phx.gbl.. .[color=blue]
      > "Coleen" <coleenholley@y ahoo.com> schrieb:[color=green]
      > > Yes, I know why would I want to create a back button when there is one[/color][/color]
      on[color=blue][color=green]
      > > the browser? Because that's what the users want! they want a[/color][/color]
      "Previous"[color=blue][color=green]
      > > button that they can click from any web page in our application that[/color][/color]
      will[color=blue][color=green]
      > > do
      > > the exact same thing as the Back button in the browser. Can anyone give
      > > me
      > > any suggestions on how to do this using VB .Net? I have Googled for
      > > "Create
      > > Back Button" and found stuff in JavaScript and HTML but nothing in VB
      > > .Net.
      > > Can this be done as simply as doing a response.redire ct? Any help would
      > > be
      > > appreciated.[/color]
      >
      > As the action takes place on the client (as does pressing the browser's
      > "Back" button) you may want to use client-side JavaScript. Solutions can[/color]
      be[color=blue]
      > found on the Web.
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>
      >[/color]


      Comment

      • Bob Lehmann

        #4
        Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

        >> Is this not supported by .Net?

        Why would it be? .Net runs on the server, and you are trying to perform a
        client action.
        [color=blue][color=green]
        >> Why is it that things that should be very simple are so convoluted in[/color][/color]
        ..Net?

        What makes you think it's simple? Is because you think simply?

        Or is it because you are trying so hard to *make* it not simple?

        Why do you want to go back to the server to perform an action that is
        handled more simply, and natively on the client?

        What is convoluted about it?

        Of course, if you insist on going back to the server, I guess you could
        store the previous page in a session variable, post back to the server, read
        the variable, and redirect to that page.

        But, that would be not simple, and also very convoluted. Oh, yeah - and
        stupid.

        Bob Lehmann

        "Coleen" <coleenholley@y ahoo.com> wrote in message
        news:%23Lxi0Qsf GHA.2172@TK2MSF TNGP04.phx.gbl. ..[color=blue]
        > Yes, I know I can use JavaScript, thanks. I was trying to find out if[/color]
        there[color=blue]
        > is a way to do this using VB.Net? I have been reading all the help files
        > and searching on-line but can't find anything to accomplish this in VB[/color]
        ..Net.[color=blue]
        > Is this not supported by .Net? Why is it that things that should be very
        > simple are so convoluted in .Net?
        >
        > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        > news:Oupxe%23rf GHA.764@TK2MSFT NGP05.phx.gbl.. .[color=green]
        > > "Coleen" <coleenholley@y ahoo.com> schrieb:[color=darkred]
        > > > Yes, I know why would I want to create a back button when there is one[/color][/color]
        > on[color=green][color=darkred]
        > > > the browser? Because that's what the users want! they want a[/color][/color]
        > "Previous"[color=green][color=darkred]
        > > > button that they can click from any web page in our application that[/color][/color]
        > will[color=green][color=darkred]
        > > > do
        > > > the exact same thing as the Back button in the browser. Can anyone[/color][/color][/color]
        give[color=blue][color=green][color=darkred]
        > > > me
        > > > any suggestions on how to do this using VB .Net? I have Googled for
        > > > "Create
        > > > Back Button" and found stuff in JavaScript and HTML but nothing in VB
        > > > .Net.
        > > > Can this be done as simply as doing a response.redire ct? Any help[/color][/color][/color]
        would[color=blue][color=green][color=darkred]
        > > > be
        > > > appreciated.[/color]
        > >
        > > As the action takes place on the client (as does pressing the browser's
        > > "Back" button) you may want to use client-side JavaScript. Solutions[/color][/color]
        can[color=blue]
        > be[color=green]
        > > found on the Web.
        > >
        > > --
        > > M S Herfried K. Wagner
        > > M V P <URL:http://dotnet.mvps.org/>
        > > V B <URL:http://classicvb.org/petition/>
        > >[/color]
        >
        >[/color]


        Comment

        • Coleen

          #5
          Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

          Thanks for your insults - I mean input!

          "Bob Lehmann" <nospam@dontbot herme.zzz> wrote in message
          news:u%23MSNUtf GHA.1456@TK2MSF TNGP04.phx.gbl. ..[color=blue][color=green][color=darkred]
          > >> Is this not supported by .Net?[/color][/color]
          >
          > Why would it be? .Net runs on the server, and you are trying to perform a
          > client action.
          >[color=green][color=darkred]
          > >> Why is it that things that should be very simple are so convoluted in[/color][/color]
          > .Net?
          >
          > What makes you think it's simple? Is because you think simply?
          >
          > Or is it because you are trying so hard to *make* it not simple?
          >
          > Why do you want to go back to the server to perform an action that is
          > handled more simply, and natively on the client?
          >
          > What is convoluted about it?
          >
          > Of course, if you insist on going back to the server, I guess you could
          > store the previous page in a session variable, post back to the server,[/color]
          read[color=blue]
          > the variable, and redirect to that page.
          >
          > But, that would be not simple, and also very convoluted. Oh, yeah - and
          > stupid.
          >
          > Bob Lehmann
          >
          > "Coleen" <coleenholley@y ahoo.com> wrote in message
          > news:%23Lxi0Qsf GHA.2172@TK2MSF TNGP04.phx.gbl. ..[color=green]
          > > Yes, I know I can use JavaScript, thanks. I was trying to find out if[/color]
          > there[color=green]
          > > is a way to do this using VB.Net? I have been reading all the help[/color][/color]
          files[color=blue][color=green]
          > > and searching on-line but can't find anything to accomplish this in VB[/color]
          > .Net.[color=green]
          > > Is this not supported by .Net? Why is it that things that should be[/color][/color]
          very[color=blue][color=green]
          > > simple are so convoluted in .Net?
          > >
          > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
          > > news:Oupxe%23rf GHA.764@TK2MSFT NGP05.phx.gbl.. .[color=darkred]
          > > > "Coleen" <coleenholley@y ahoo.com> schrieb:
          > > > > Yes, I know why would I want to create a back button when there is[/color][/color][/color]
          one[color=blue][color=green]
          > > on[color=darkred]
          > > > > the browser? Because that's what the users want! they want a[/color]
          > > "Previous"[color=darkred]
          > > > > button that they can click from any web page in our application that[/color]
          > > will[color=darkred]
          > > > > do
          > > > > the exact same thing as the Back button in the browser. Can anyone[/color][/color]
          > give[color=green][color=darkred]
          > > > > me
          > > > > any suggestions on how to do this using VB .Net? I have Googled for
          > > > > "Create
          > > > > Back Button" and found stuff in JavaScript and HTML but nothing in[/color][/color][/color]
          VB[color=blue][color=green][color=darkred]
          > > > > .Net.
          > > > > Can this be done as simply as doing a response.redire ct? Any help[/color][/color]
          > would[color=green][color=darkred]
          > > > > be
          > > > > appreciated.
          > > >
          > > > As the action takes place on the client (as does pressing the[/color][/color][/color]
          browser's[color=blue][color=green][color=darkred]
          > > > "Back" button) you may want to use client-side JavaScript. Solutions[/color][/color]
          > can[color=green]
          > > be[color=darkred]
          > > > found on the Web.
          > > >
          > > > --
          > > > M S Herfried K. Wagner
          > > > M V P <URL:http://dotnet.mvps.org/>
          > > > V B <URL:http://classicvb.org/petition/>
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Coleen

            #6
            Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

            Sorry I couldn't Resist :-)

            The plain "simple" truth is that I don't know JavaScript - and honestly do
            NOT know that much about what calls the server and what calls the client so
            I did not realize that Javascript does not call the server while .Net
            does...so my remarks were in ignorance of .Net's capabilities not meant to
            belittle .Net - only that I thought this should be a simple thing to do.

            The problem I am having is that since I do not Know JavaScript, the code
            that I have found on-line to do this simple (yes the CODE IS simple in
            JavaScript and even in HTML!) but I am using a User Control that has
            multiple buttons and I put the code for the Back button in the User Control
            VB code-behind:

            btn_prev.Attrib utes.Add("oncli ck", "javascript:his tory.go(-1);")
            btn_prev.Attrib utes.Add("oncli ck", "javascript:his tory.back();")

            Neither one of these works, and since I don't know JavaScript I do NOT know
            how to get this to work!

            If you have any suggestions I would appreciate them.

            Coleen

            "Coleen" <coleenholley@y ahoo.com> wrote in message
            news:e9ujOU0fGH A.4900@TK2MSFTN GP02.phx.gbl...[color=blue]
            > Thanks for your insults - I mean input!
            >
            > "Bob Lehmann" <nospam@dontbot herme.zzz> wrote in message
            > news:u%23MSNUtf GHA.1456@TK2MSF TNGP04.phx.gbl. ..[color=green][color=darkred]
            > > >> Is this not supported by .Net?[/color]
            > >
            > > Why would it be? .Net runs on the server, and you are trying to perform[/color][/color]
            a[color=blue][color=green]
            > > client action.
            > >[color=darkred]
            > > >> Why is it that things that should be very simple are so convoluted in[/color]
            > > .Net?
            > >
            > > What makes you think it's simple? Is because you think simply?
            > >
            > > Or is it because you are trying so hard to *make* it not simple?
            > >
            > > Why do you want to go back to the server to perform an action that is
            > > handled more simply, and natively on the client?
            > >
            > > What is convoluted about it?
            > >
            > > Of course, if you insist on going back to the server, I guess you could
            > > store the previous page in a session variable, post back to the server,[/color]
            > read[color=green]
            > > the variable, and redirect to that page.
            > >
            > > But, that would be not simple, and also very convoluted. Oh, yeah - and
            > > stupid.
            > >
            > > Bob Lehmann
            > >
            > > "Coleen" <coleenholley@y ahoo.com> wrote in message
            > > news:%23Lxi0Qsf GHA.2172@TK2MSF TNGP04.phx.gbl. ..[color=darkred]
            > > > Yes, I know I can use JavaScript, thanks. I was trying to find out if[/color]
            > > there[color=darkred]
            > > > is a way to do this using VB.Net? I have been reading all the help[/color][/color]
            > files[color=green][color=darkred]
            > > > and searching on-line but can't find anything to accomplish this in VB[/color]
            > > .Net.[color=darkred]
            > > > Is this not supported by .Net? Why is it that things that should be[/color][/color]
            > very[color=green][color=darkred]
            > > > simple are so convoluted in .Net?
            > > >
            > > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
            > > > news:Oupxe%23rf GHA.764@TK2MSFT NGP05.phx.gbl.. .
            > > > > "Coleen" <coleenholley@y ahoo.com> schrieb:
            > > > > > Yes, I know why would I want to create a back button when there is[/color][/color]
            > one[color=green][color=darkred]
            > > > on
            > > > > > the browser? Because that's what the users want! they want a
            > > > "Previous"
            > > > > > button that they can click from any web page in our application[/color][/color][/color]
            that[color=blue][color=green][color=darkred]
            > > > will
            > > > > > do
            > > > > > the exact same thing as the Back button in the browser. Can[/color][/color][/color]
            anyone[color=blue][color=green]
            > > give[color=darkred]
            > > > > > me
            > > > > > any suggestions on how to do this using VB .Net? I have Googled[/color][/color][/color]
            for[color=blue][color=green][color=darkred]
            > > > > > "Create
            > > > > > Back Button" and found stuff in JavaScript and HTML but nothing in[/color][/color]
            > VB[color=green][color=darkred]
            > > > > > .Net.
            > > > > > Can this be done as simply as doing a response.redire ct? Any help[/color]
            > > would[color=darkred]
            > > > > > be
            > > > > > appreciated.
            > > > >
            > > > > As the action takes place on the client (as does pressing the[/color][/color]
            > browser's[color=green][color=darkred]
            > > > > "Back" button) you may want to use client-side JavaScript.[/color][/color][/color]
            Solutions[color=blue][color=green]
            > > can[color=darkred]
            > > > be
            > > > > found on the Web.
            > > > >
            > > > > --
            > > > > M S Herfried K. Wagner
            > > > > M V P <URL:http://dotnet.mvps.org/>
            > > > > V B <URL:http://classicvb.org/petition/>
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • aaron.kempf@gmail.com

              #7
              Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

              i think that this would be complex in vb.net; i mean-- you would need
              to encode an undo functionality to everything you.

              perhaps starting a transaction and not commiting it would be the way to
              go?

              are you building data entry apps??

              -Aaron

              Comment

              • Coleen

                #8
                Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

                Yes. The app is an on-line entry for users and we have created a "Footer"
                user control that has all the buttons for Back, Submit, Next , Add, Clear or
                Update the current page. Some buttons will have slightly different
                functions from page to page, but buttons such as the Back, Next, and Submit
                will always do the same thing. So I am trying to set up the code to do the
                Back and next buttons in the User Control. The code I showed before for the
                JavaScript doesn't work, so since I'm not a JavaScript programmer I don't
                know how to troubleshoot it. If you have any suggestions on how to embed a
                JavaScript function in a VB/ASCX User Control, I would greatly appreciate
                any help.

                Thanks :-)

                Coleen


                <aaron.kempf@gm ail.com> wrote in message
                news:1148493471 .895833.277870@ j33g2000cwa.goo glegroups.com.. .[color=blue]
                > i think that this would be complex in vb.net; i mean-- you would need
                > to encode an undo functionality to everything you.
                >
                > perhaps starting a transaction and not commiting it would be the way to
                > go?
                >
                > are you building data entry apps??
                >
                > -Aaron
                >[/color]


                Comment

                • Coleen

                  #9
                  Re: Creating a &quot;Back&quot ; button in VB.Net/ASP.Net

                  Okay - I got some help from someone who knows JavaScript here and we solved
                  this by putting the code:
                  btn_prev.Attrib utes.Add("oncli ck", "javascript : history.go(-1); return
                  false;")
                  in the Page load of the user control instead of in the Click event of the
                  control. Two things here - I was not using the return false option or
                  spacing the JavaScript code correctly, and the code has to be in the page
                  load not in the Click event. Any way, this is the solution for any one else
                  who comes across this problem.

                  Coleen

                  "Coleen" <coleenholley@y ahoo.com> wrote in message
                  news:%23jDhfUrf GHA.3456@TK2MSF TNGP05.phx.gbl. ..[color=blue]
                  > Yes, I know why would I want to create a back button when there is one on
                  > the browser? Because that's what the users want! they want a "Previous"
                  > button that they can click from any web page in our application that will[/color]
                  do[color=blue]
                  > the exact same thing as the Back button in the browser. Can anyone give[/color]
                  me[color=blue]
                  > any suggestions on how to do this using VB .Net? I have Googled for[/color]
                  "Create[color=blue]
                  > Back Button" and found stuff in JavaScript and HTML but nothing in VB[/color]
                  ..Net.[color=blue]
                  > Can this be done as simply as doing a response.redire ct? Any help would[/color]
                  be[color=blue]
                  > appreciated.
                  >
                  > Coleen
                  >
                  >[/color]


                  Comment

                  Working...