MVC 附加“#”到查询字符串
我为一些非常简单的事情而苦苦挣扎......帮忙吗?
我想做以下事情: 我有两个带有选项卡的页面(JQuery),我想记住选项卡选择。我决定使用查询字符串来实现这一目标,但在页面之间切换时我不知道如何传递选项卡。
示例:我有一个网址 http://localhost/Object/Edit/1#tab_tax1
我有到其他页面的链接:
<%= Html.ActionLink(Resource.Details, "Details", new { id = Model.Object.ID })%>
我想以某种方式传递“#tab_tax1”,所以我也将选择保留在其他页面中。
谢谢!
I struggle with something really simple... help?
I want to do the following:
I have two pages with tabs (JQuery) and I want to remember the tab selection. I decided to use the query string in order to achieve that, but switching between pages I don't know how to pass the tab.
Example: I have an url http://localhost/Object/Edit/1#tab_tax1
And I have my link to the other page:
<%= Html.ActionLink(Resource.Details, "Details", new { id = Model.Object.ID })%>
I want to pass somehow the "#tab_tax1" so I keep the selection in the other page too.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不使用操作链接,只在“a”标签的 href 中编写 url:
instead of using action link compose only the url inside the href of the "a" tag:
您使用 JQuery 选项卡,这意味着您可以使用 cookie。那么你实际上不需要将选项卡附加到 url 中,因为它存储在 cookie 中。
You use JQuery tabs, so that means you can use the cookies. Then you don't really need to append the tab to the url, because it is stored in the cookie.
使用片段参数。
希望这有帮助。
Use fragement parameter.
Hope this help.