Reputation: 1230
net use web methods to save data from JavaScript when i press save the all page go the top how i can save state position after post back
Upvotes: 0
Views: 3758
Reputation: 1230
I solved the question, and my method of doing this was the following:
I put a javascript:void(0)
in an a
tag, as shown here:
<a href="javascript:void(0)">
Upvotes: 0
Reputation: 514
try to setting the following page directive in your page
<%@ Page MaintainScrollPositionOnPostback="true" %>
Upvotes: 0
Reputation: 9242
You can set it programmatically
Page.MaintainScrollPositionOnPostBack = true;
In the page declaration
<%@ Page MaintainScrollPositionOnPostback="true" %>
Or in the web.configs <system.web>
section.
<pages maintainScrollPositionOnPostBack="true" />
Upvotes: 1
Reputation: 18586
The reason the page is returning to the top, is because it is being Submitted and hence reloaded.
If you want to keep the position of the page you have 2 options;
1) Use a Anchor (See: http://www.hypergurl.com/anchors.html) 2) Post your form using AJAX and then you do not need to reload the page
Option 2 is the prefered, if you are using webforms you could use an AJAX Update Panel, or if you are using MVC you can do it using JQuery.
Upvotes: 0