aneellu Posted September 6, 2007 Share Posted September 6, 2007 Hi all,I have a situation where in a user selects a value in a combo list it gets submitted to server on onchange event to populateother combo lists.I have many combo lists in a page and after user selects value in a combo list then page gets submitted to server and after return vertical scrollbar jumps to the top instead of staying at the position when a value was selectedbefore submitting.This is new to me. Whether this problem can be solved using javascript....Any idea or help is appreciated....Thanks,Anil. Link to comment Share on other sites More sharing options...
jesh Posted September 6, 2007 Share Posted September 6, 2007 You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position Link to comment Share on other sites More sharing options...
justsomeguy Posted September 6, 2007 Share Posted September 6, 2007 Or, you can use AJAX to have Javascript do the submission, update the next dropdown, and then the page won't reload at all. Link to comment Share on other sites More sharing options...
aneellu Posted September 10, 2007 Author Share Posted September 10, 2007 You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position Hi jesh,Thanks for the reply.......Iam using java as my server side technology. Can you redirect to me any usefull links that discuss the problem.thanks Anil Link to comment Share on other sites More sharing options...
aneellu Posted October 8, 2007 Author Share Posted October 8, 2007 You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position Hi,Thanks alot for the hint you provided earlier I could use scrollTop DOM property to avoid Page Jumping, but i couldn't do it for anchor tag.when i click the anchor tag after postback it again jumps to the top.why scrollTop is not applicable to anchor tag....?Thanks in advance,Anil. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.