3

这种观点:

@Using Html.BeginForm
    SimpleMessage
End Using

@Helper SimpleMessage()
    @<p>This is a simple message</p>
End Helper

结果是

<form action="/Controller/Action" method="post"></form>

@* Now let's not call it from within a using *@
@SimpleMessage

@Helper SimpleMessage()
    @<p>This is a simple message</p>
End Helper

结果是

<p>This is a simple message</p>

为什么我的助手在我的内部不工作Using Html.BeginForm

4

1 回答 1

5

您需要@在辅助方法前面使用符号。

@Using Html.BeginForm
    @SimpleMessage
End Using
于 2013-03-07T02:20:01.653 回答