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 に答える