失败的Razor IF语句(适用于VB应用程序)

时间:2014-04-02 17:26:25

标签: asp.net-mvc razor

我不确定以下Razor代码的正确语法(对于VB应用程序):

编译错误

描述:编译服务此请求所需的资源时发生错误。请查看以下特定错误详细信息并相应地修改源代码。

编译器错误消息:BC30035:语法错误。

来源错误:

Line 20:                 <br />
Line 21:                 @If (ViewBag.vejpEdit.Equals(Nothing)) Then
Line 22:                 {
Line 23:                     @Html.ActionLink("Edit", "Edit", "AdditionalDivData", New With {.id = currentItem.AddDataId, .projId = ViewBag.ProjId, .divisionControllerName = ViewBag.DivisionControllerName, .divisionName = ViewBag.DivisionName, .vejpEdit = False}, New With {.class = "divisiontransitionbutton"}) |
Line 24:                 }

感谢。

1 个答案:

答案 0 :(得分:0)

你混淆了VB和C#语法。这是正确的VB版本:

@If ViewBag.vejpEdit Is Nothing Then
    @Html.ActionLink("Edit", "Edit", "AdditionalDivData", New With {.id = currentItem.AddDataId, .projId = ViewBag.ProjId, .divisionControllerName = ViewBag.DivisionControllerName, .divisionName = ViewBag.DivisionName, .vejpEdit = False}, New With {.class = "divisiontransitionbutton"}) 
End If