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. Scrollbar position on a panel web server control

Scrollbar position on a panel web server control

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestion
3 Posts 2 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.
  • J Offline
    J Offline
    John Strudwick
    wrote on last edited by
    #1

    Anyone know how to get / set the position of the scrollbars on a panel web server control. Thus I can remember where a user was in a given panel, if they had used the scroll bars??? Many thanks

    M 1 Reply Last reply
    0
    • J John Strudwick

      Anyone know how to get / set the position of the scrollbars on a panel web server control. Thus I can remember where a user was in a given panel, if they had used the scroll bars??? Many thanks

      M Offline
      M Offline
      m rastgar
      wrote on last edited by
      #2

      yourpanleid.scrollTop, yourpanelid.scrollLeft. for your panel id, refer your page html which is rendered. note, these two methods are client side methods. you can save them in a hidden field. i save them in a hidden textbox by scrollchange() method. and set them by changescroll() method: function scrollchange() { document.getElementById("txtScroll").value=document.body.scrollTop; document.getElementById("txtScroll").value+=";"+document.body.scrollLeft; } function changescroll() { if(document.getElementById("txtScroll").value != "") { parts = document.getElementById("txtScroll").value.split(";"); document.body.scrollTop = parseInt(parts[0]); document.body.scrollLeft = parseInt(parts[1]); } } Thanks Rastgar

      J 1 Reply Last reply
      0
      • M m rastgar

        yourpanleid.scrollTop, yourpanelid.scrollLeft. for your panel id, refer your page html which is rendered. note, these two methods are client side methods. you can save them in a hidden field. i save them in a hidden textbox by scrollchange() method. and set them by changescroll() method: function scrollchange() { document.getElementById("txtScroll").value=document.body.scrollTop; document.getElementById("txtScroll").value+=";"+document.body.scrollLeft; } function changescroll() { if(document.getElementById("txtScroll").value != "") { parts = document.getElementById("txtScroll").value.split(";"); document.body.scrollTop = parseInt(parts[0]); document.body.scrollLeft = parseInt(parts[1]); } } Thanks Rastgar

        J Offline
        J Offline
        John Strudwick
        wrote on last edited by
        #3

        Hi Rastgar Many thanks for the pointer - FYI my implementation of the initialisation, is like this: (c#) StringBuilder sb = new StringBuilder(); sb.Append(""); sb.Append("var szValue = document.getElementById('Panel1');"); sb.Append("szValue.scrollTop = 146;"); sb.Append("szValue.scrollLeft = 182;"); sb.Append(""); ClientScript.RegisterStartupScript(typeof(string), "Init", sb.ToString()); This then just runs at startup. And of course I can harvest the values from the user by any number of means Once again, many thanks regards, John

        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