相关:MVC3 Razor using Html.BeginForm problem
当我使用 Razor 引擎为 MVC 3/VB 制作 HTML 表单时,我希望能够这样做:
@Using Html.BeginForm("Action", "Controller")
<fieldset>
@* Other form code and values *@
</fieldset>
End Using
但是,如果我这样做,我会得到“BC32035:属性说明符不是完整的语句。使用行继续符将该属性应用于以下语句。”我需要在开始标记之前添加一个@ 字符以避免此错误。有人可以解释为什么吗?
最佳答案
我相信 Razor beginform 应该是这样的,即带花括号:
@using (Html.BeginForm())
{
@* Other code here *@
}
关于asp.net-mvc - 为什么@Using Html.BeginForm 中的普通标记需要@?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10225394/