Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. returning to same place on long page

returning to same place on long page

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionannouncement
20 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M MacIntyre

    I'm developing in apsx.net and vb.net 2005. I have 3 pages in my application that are longer than one viewing screen, causing the uwser to scroll to update and see data down the page. The first is of static size, that is the actual page size does not change, there is just a lot of information on the page and the user needs to be able to see all and make changes before processing. The other two pages are dynamic in nature based on choices that the client makes. The problem I'm having is that each time the user makes a change that required him to scroll down the page, when the page refreshes, it returns to the top, forcing the user to scroll back down the page to see the affect of his changes. How do I get the page to refresh with the same view the user had when the change was made. Thanks in advance for your assistance.. Chuck..

    N Offline
    N Offline
    Not Active
    wrote on last edited by
    #9

    MaintainScrollPositionOnPostBack[^] return the user to the same position in the client browser after postback.


    I know the language. I've read a book. - _Madmatt

    Y M 4 Replies Last reply
    0
    • Y Yusuf

      Anchor tag is your friend. Look at the named anchor tag. When you post to the page, pass the anchor tag and the page will scroll (automagically) on refresh. Anchor Tag Help[^]

      Yusuf May I help you?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #10

      Yusuf wrote:

      Anchor tag is your friend

      Not in this situation. It is a cumbersome and unmaintainable mechanism for this usage


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • M MacIntyre

        Yusuf, this looks like something that will really work for me. First I have never used anchors before so there a little be of confusion here on my part. This is an asp.net with vb.net as the code behind. So when something is changed that causes a postback then the code behind is invoked. How do I activate the anchor location so when the page is redisplayed it envokes the target anchor because there will be at least 20 anchors on each page? So just to be clear I don't have a problem with creating a hundred anchors if necessary, it is just how to activate the appropiate anchor. If for example an entry from the travel dropdownlist is selected I will need to process the selection then redisplay the page. Upon selecting the dropdownlist theI will need to know its anchor. After exceuting the AutoPostBack routine I will want to return to the anchor for that dropdownlist location. I hope I am not making this too complicated. Thanks again.. Chuck..

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #11

        MacIntyre wrote:

        looks like something that will really work for me.

        I wouldn't use it. It is cumbersome and unmaintainable.


        I know the language. I've read a book. - _Madmatt

        1 Reply Last reply
        0
        • N Not Active

          MaintainScrollPositionOnPostBack[^] return the user to the same position in the client browser after postback.


          I know the language. I've read a book. - _Madmatt

          Y Offline
          Y Offline
          Yusuf
          wrote on last edited by
          #12

          Damn classic asp. You are right. I have being working on the classic asp lately and my memory is filled with that filth

          Yusuf May I help you?

          1 Reply Last reply
          0
          • M MacIntyre

            Yusuf, this looks like something that will really work for me. First I have never used anchors before so there a little be of confusion here on my part. This is an asp.net with vb.net as the code behind. So when something is changed that causes a postback then the code behind is invoked. How do I activate the anchor location so when the page is redisplayed it envokes the target anchor because there will be at least 20 anchors on each page? So just to be clear I don't have a problem with creating a hundred anchors if necessary, it is just how to activate the appropiate anchor. If for example an entry from the travel dropdownlist is selected I will need to process the selection then redisplay the page. Upon selecting the dropdownlist theI will need to know its anchor. After exceuting the AutoPostBack routine I will want to return to the anchor for that dropdownlist location. I hope I am not making this too complicated. Thanks again.. Chuck..

            Y Offline
            Y Offline
            Yusuf
            wrote on last edited by
            #13

            Chris, forget I told you, go with Mark's suggestions http://www.codeproject.com/Messages/3477022/Re-returning-to-same-place-on-long-page.aspx[^] My mind is clattered with the old classic asp filth. Sorry for the mess.

            Yusuf May I help you?

            1 Reply Last reply
            0
            • M MacIntyre

              I'm developing in apsx.net and vb.net 2005. I have 3 pages in my application that are longer than one viewing screen, causing the uwser to scroll to update and see data down the page. The first is of static size, that is the actual page size does not change, there is just a lot of information on the page and the user needs to be able to see all and make changes before processing. The other two pages are dynamic in nature based on choices that the client makes. The problem I'm having is that each time the user makes a change that required him to scroll down the page, when the page refreshes, it returns to the top, forcing the user to scroll back down the page to see the affect of his changes. How do I get the page to refresh with the same view the user had when the change was made. Thanks in advance for your assistance.. Chuck..

              E Offline
              E Offline
              Enobong Adahada
              wrote on last edited by
              #14

              pls i have this code protected void Page_PreLoad(object sender, EventArgs e) { MaintainScrollPositionOnPostBack = true; } but the page still scrolls up when i click a button. pls help.

              M 1 Reply Last reply
              0
              • N Not Active

                MaintainScrollPositionOnPostBack[^] return the user to the same position in the client browser after postback.


                I know the language. I've read a book. - _Madmatt

                M Offline
                M Offline
                MacIntyre
                wrote on last edited by
                #15

                Ok, so we have been through that exercise and discovered that for implementing asp.net that it is not practical to do this. What is a more practical solution, remembering that this is webforms? We are talking the use of both buttons and dropdownlists and exiting from fields that have changed.. Thanks again..

                1 Reply Last reply
                0
                • N Not Active

                  MaintainScrollPositionOnPostBack[^] return the user to the same position in the client browser after postback.


                  I know the language. I've read a book. - _Madmatt

                  M Offline
                  M Offline
                  MacIntyre
                  wrote on last edited by
                  #16

                  So will this work with all types of returns, field changes, button clicks and changes in dropdownlists?

                  N 1 Reply Last reply
                  0
                  • M MacIntyre

                    So will this work with all types of returns, field changes, button clicks and changes in dropdownlists?

                    N Offline
                    N Offline
                    Not Active
                    wrote on last edited by
                    #17

                    Have you read the documentation?


                    I know the language. I've read a book. - _Madmatt

                    M 1 Reply Last reply
                    0
                    • N Not Active

                      Have you read the documentation?


                      I know the language. I've read a book. - _Madmatt

                      M Offline
                      M Offline
                      MacIntyre
                      wrote on last edited by
                      #18

                      No sir. Not yet.. I was looking at the next message and inquiring? Thanks..

                      1 Reply Last reply
                      0
                      • E Enobong Adahada

                        pls i have this code protected void Page_PreLoad(object sender, EventArgs e) { MaintainScrollPositionOnPostBack = true; } but the page still scrolls up when i click a button. pls help.

                        M Offline
                        M Offline
                        MacIntyre
                        wrote on last edited by
                        #19

                        Place the MaintainScrollPositionOnPostBack="True" statement in the Page directives at the top of the aspx page. I had to do additional searches to find how to use it. Works great for me so far in all cases.. Good luck..

                        1 Reply Last reply
                        0
                        • N Not Active

                          MaintainScrollPositionOnPostBack[^] return the user to the same position in the client browser after postback.


                          I know the language. I've read a book. - _Madmatt

                          M Offline
                          M Offline
                          MacIntyre
                          wrote on last edited by
                          #20

                          Mark, Great Answer.. The only problem is the documentation on how to is a little obscure for those of use that did not go through the embedded asp wars. But as you say a little research will get to the answer. Thanks again for a great call... Chuck..

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups