Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 动作链接按钮_Asp.net Mvc_Asp.net Mvc 3_Asp.net Mvc 4 - Fatal编程技术网

Asp.net mvc 动作链接按钮

Asp.net mvc 动作链接按钮,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 3,Asp.net Mvc 4,我正在从VB转换到C语言,在尝试为下面的razor代码(将动作链接显示为按钮)计算C语言的等价物时遇到了问题 我不熟悉VB,但当您创建以下匿名对象时,它应该可以工作: @Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage", new {id = currentItem.CustomerId}, new { @class = "btn"}) 在类属性之前需要@,因为类

我正在从VB转换到C语言,在尝试为下面的razor代码(将动作链接显示为按钮)计算C语言的等价物时遇到了问题


我不熟悉VB,但当您创建以下匿名对象时,它应该可以工作:

@Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage", 
                     new {id = currentItem.CustomerId}, new  { @class = "btn"})
属性之前需要
@
,因为
是C#中的保留字。您可能想了解更多信息。

覆盖

剃须刀
@Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage", 
                     new {id = currentItem.CustomerId}, new  { @class = "btn"})
@Html.ActionLink("LinkText", "Action", "Controller", 
                   new { @id = currentItem.CustomerId }, new { @class = "abc" })