i have a form which i validate on code behind, after postback the page is on its topmost, i wanted it to move to an anchor somewhere in my page, anyone knows how to do this, or is there an alternative to this?
I think santa left a little hash in hb's stocking.
I don't see what that web page has to do with the question.
Anyway...if you don't need to save the viewstate of the page...you can simply name an anchor...
<a href="#" name="myAnchor"></a>
and do a Response.Redirect in the postback
if (IsPostBack)
{
Response.Redirect("mypage.aspx#myAnchor");
}
A better approach would be to use XmlHttpRequest, send the form data to the function that processes it, and then just move the page down to the anchor with some javascript. The page doesn't have to reload.
I was thinking something complex usign javascript to scroll the browser to the position of an element but using bookmarks is a simple and much more straightforward approach. Had I thought of it, I would have recommended it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.