使用"数据切换"与Html.ActionLink [英] Using "data-toggle" with Html.ActionLink
本文介绍了使用"数据切换"与Html.ActionLink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要使用数据触发ActionLink的室内用。像这样的;
I want to use "data-toggle" wiht actionLink. Like this;
Html.ActionLink("Delete", "Users", "Admin", new { item.UserId , strRole = strRole }, new { id = "cmdDelete", href="#myAlert", data-toggle="modal" })
不幸的是,不接受。我如何使用数据触发之类非标准链接?
Unfortunately, doesn't accept. How can i use "data-toggle" like standart links?
推荐答案
您不能。但有一个简单的解决方法。你要做的就是,更换 - 用_。在运行时,它会转换为一个破折号( - )。
因此;
You can't. But there is a simple work-around. What you do is, replace the - with a _. During runtime it will get converted to a dash (-). So;
Html.ActionLink("Delete", "Users", "Admin", new { item.UserId , strRole = strRole }, new { id = "cmdDelete", href="#myAlert", data_toggle="modal" })
这篇关于使用"数据切换"与Html.ActionLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文