Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using "data-toggle" with Html.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?

like image 386
nermik Avatar asked Oct 19 '12 14:10

nermik


1 Answers

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" }) 
like image 100
Nickvda Avatar answered Sep 25 '22 06:09

Nickvda