SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Holding scroll position using .net and CSS overflow on postback...which technology?

    Hi, I am a newbie here and have a problem that is above my current tech level. I am hoping to find some help/suggestions.

    My front page is an asp.net webform with two form controls: a sidebar, and a general form control that displays dynamic web content. Within the sidebar control I am using the standard HTML UL/LI list syntax to list all of the categories on my site. E.g.: apparel, electronics, etc... User clicks on the sidebar and is sent to the control that displays the dynamic content.

    I am using a CSS div that has the overflow set to auto in the sidebar control. When user clicks on one of the categories within the sidebar, the whole page resets the two controls and sends the sidebar's position back to the top. Problem is that the sidebar is many pages long and if the user is browsing, he will have to re scroll down to the position where they clicked.

    I've searched the web for answers. On this site i read http://www.sitepoint.com/preserve-page-scroll-position/ which is a pretty neat javascript solution. I am thinking of trying this but not sure if it will work with the multiple controls in play for .net.

    If anyone has had this issue before or can point me to a forum that can assist, I'd be great full. Or I'd be willing to pay for this to learn and to get past the problem.

    thank you

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,622
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    You could do something like Wikipedia does. At the top of each page, Wikipedia has links and when clicked, it sends you down to the part of the page you wanted.

    It's done by doing the following.
    <a href="#manman">godowntotest</a>
    ...
    <div name="manman">test</div>

    When you click the link in your example, the URL will have it go down to where it's supposed to go, that way, the user won't have to resscroll. The key is to make sure the anchor hash tag marks the elements name="" and the element has the name="" set.

    I don't know if this is feasible or not for you due to me not knowing the specific workings, but perhaps you can try that out.

    If it wasn't of any use to you, you can always try the javascript solution, and create a backup page (replica) just in case something goes horribly wrong. You should never have to pay for the free help given here. We help due to us wanting to, and partly because we have nothing else better to do .
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well.. as I have admitted in my first post asking for help on this website.. I'm crap at css... but your problem is easy for an asp.net programmer... have a look at "MaintainScrollPositionOnPostback".. What this does basically is it remembers the page postion
    after postback for you.

    happy coding :-)


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
  •