Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted
tnx HJB417, ill give it a try

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted

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.

Posted
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.
  • 2 weeks later...
Posted

thanks guys, that ought to do it

 

anyway this was just an optional function im trying to implement, i might stick to this for awhile

 

<%@ Page Language="vb" MaintainScrollPositionOnPostBack="true" %>

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...