开发者

Remove anchor on postback

开发者 https://www.devze.com 2022-12-13 07:22 出处:网络
Opposite of this question: Retain anchor after postback in asp.net I\'m having the issue that on postback, it\'s keeping an anchor.

Opposite of this question: Retain anchor after postback in asp.net

I'm having the issue that on postback, it's keeping an anchor.

I'm starting in Browse.aspx; user clicks something which takes them to an anchor on the page. They then choose a new filter from DropDownList, so it refreshes back to page 1 with the filter in place, but the anchor stays in the url causing them to jump down the page.

I tried added PostBackUrl="~/Browse.aspx" attribute to the DropDow开发者_Python百科nList to no avail.

Any ideas?

Note, I'm sending them to the anchor with he following method in code behind:

    RegisterStartupScript("navigateto", "<script type='text/javascript'>document.location.href='#photo1';</script>");


I think you'll have to do a server.redirect (or inject another client script that refreshes the page) when the user chooses a new filter, without the anchor in the url. The browser on its own will not lose it during post-backs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号