views:

312

answers:

1

I'm using the following code to move to this part of the page:

.
.
.<a title="news" name="news"></a>
.
.

But when I access or REDIRECTS from another page to this page using the URL like: http://localhost/mypage.aspx#news, the page goes to that part and again comes at the top of the page automatically changing the URL to http://localhost/mypage.aspx#.

There is no manually written javascript on page load in my code. The code does uses AJAX, UpdatePanel etc.

What could be the other possible reasons? Any help appreciated.

+2  A: 

Are you absolutely sure there is no javascript? You've tagged the question asp.net - maybe the framework adds some javascript to the rendered page?

If the MaintainScrollPositionOnPostback directive is set on the page, it might cause the behavior described in the question. Is this property set on the page? Or maybe on a master page?

Jørn Schou-Rode
You were absolutely right...I disabled JS and checked the link, it worked then...there is something getting added which is causing this behaviour... thanks
Manish
BTW, there is no MaintainScrollPositionOnPostback in the page or even in master page. FYI, its not a postback. :-) I'm directly redirecting to that page.I'm still not able to solve the problem. But it's some javascript for sure.
Manish
Can you send a link to the page displaying the problem? If the site is not online, maybe just a copy of the rendered HTML from your development server.
Jørn Schou-Rode
No..actually it's a part of the project... :-)FYI, it's using AJAX too...Can u tell me any software for javascript debugger to stop exactly when the "window.location.hash" changes!
Manish
I am not aware of any tools that will cause a break whenever `window.location.hash` is changed. Maybe you could set a bunch of break points (one in the top of each function) with Firebug (getfirebug.com) and then use the "continue" button to skip along until the screen jumps to the top. This should narrow you in on the bug, and you can continue with new break points within the critical section of javascript code.
Jørn Schou-Rode