Html.Action 链接和 Html.RouteLink

发布于 2024-08-28 06:55:35 字数 301 浏览 5 评论 0原文

即使 url 相同,我也可以使用 Html.RouteLink 和 Action Link 转到不同的操作。就像当我单击新闻链接时,我将转到新闻详细信息。此页面的 url 是 http://localhost:1390/en-US/latestnews/125.Now 如果我在中选择语言的 ddl此页面中的站点标题我需要 转到站点的主页。ddl(更改时)将采用相同的 url,但这次需要转到理智控制器中的操作。

Even If the url is same can i go to different action using Html.RouteLink and Action Link.Like when i click on news link i will go to news details.The url of this page is http://localhost:1390/en-US/latestnews/125.Now if i select the ddl of language in the site header in this pagei need to
go to the home page of the site.The ddl (on change) will take the same url but this time it needs to go to action in the sane controller.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泅人 2024-09-04 06:55:35

无论您如何生成它,该 URL 将定向到它匹配的第一个路由条目上的控制器/操作。我不确定你到底想要完成什么,但我怀疑你需要做的是使用 javascript 定向到不同 url,可能是用 Html.RouteLink 生成的code> 而不是 Html.ActionLink 基于选择下拉列表时的值。如果我误解了您想要做什么,请澄清。

The URL will direct to the controller/action on the first routing entry that it matches regardless of how you generate it. I'm not sure exactly what you are trying to accomplish, but I suspect that what you need to do is use javascript to direct to a different url, perhaps generated with Html.RouteLink instead of Html.ActionLink based on the value of the drop down list when it's selected. If I'm misunderstanding what you are trying to do, please clarify.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文