MVC @ Url.Action不起作用

编程入门 行业动态 更新时间:2024-10-25 18:31:47
本文介绍了MVC @ Url.Action不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 <div class="col-xs-6 text-right margin-top-x5"> <div class="adduser pointer" data-url="@Url.Action("Register","Account")"><span class="glyphicons glyphicons-user"></span>&nbsp;Add New User</div> </div>

在FireBug上我可以看到,但不会执行该操作.

On FireBug i can see but it not going to that action.

<div class="adduser pointer" data-url="/Account/Register">

推荐答案

如果您希望 div 是可点击的,则必须为其提供一些代码,以便用户单击它.

If you want a div to be clickable, you have to give it some code to do something when the user clicks it.

$(function() { $("[data-url]").click(function() { location.href = $(this).data("url"); }); }

或者,只需使用锚点即可:

Alternatively, just use an anchor:

<a class="adduser pointer" href="@Url.Action("Register","Account")"> <span class="glyphicons glyphicons-user"></span>&nbsp;Add New User</a>

更多推荐

MVC @ Url.Action不起作用

本文发布于:2023-11-03 20:40:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1556039.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   MVC   Url   Action

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!