Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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 为什么不是';我的razor助手是否在Using语句中执行?_Asp.net Mvc_Vb.net_Asp.net Mvc 3_Razor - Fatal编程技术网

Asp.net mvc 为什么不是';我的razor助手是否在Using语句中执行?

Asp.net mvc 为什么不是';我的razor助手是否在Using语句中执行?,asp.net-mvc,vb.net,asp.net-mvc-3,razor,Asp.net Mvc,Vb.net,Asp.net Mvc 3,Razor,这一观点: @Using Html.BeginForm SimpleMessage End Using @Helper SimpleMessage() @<p>This is a simple message</p> End Helper @使用Html.BeginForm 简单消息 终端使用 @帮助程序SimpleMessage() @ 这是一个简单的信息 末端助手 导致 <form action="/Controller/Action" m

这一观点:

@Using Html.BeginForm
    SimpleMessage
End Using

@Helper SimpleMessage()
    @<p>This is a simple message</p>
End Helper
@使用Html.BeginForm
简单消息
终端使用
@帮助程序SimpleMessage()
@ 这是一个简单的信息

末端助手
导致

<form action="/Controller/Action" method="post"></form>
<p>This is a simple message</p>

但是

@*现在,我们不要在使用*@
@简单消息
@帮助程序SimpleMessage()
@ 这是一个简单的信息

末端助手
导致

<form action="/Controller/Action" method="post"></form>
<p>This is a simple message</p>
这是一条简单的消息


为什么我的助手在我的
中使用Html.BeginForm时不工作?

在助手方法前面需要
@
符号

@Using Html.BeginForm
    @SimpleMessage
End Using

在助手方法前面需要
@
符号

@Using Html.BeginForm
    @SimpleMessage
End Using

这是一个纯粹的猜测,因为我对Razor只知道一点点,但是如果你在using中使用
SimpleMessage
前面的
@
符号会发生什么呢?你明白了!我怎么会错过呢?我想既然我是在代码中,我就不需要
@
来调用函数,这是真的,但显然你是为剃刀助手做的。@jpmc26,我想你说对了一半。我想他也需要()在VB.NET中不需要括号,尽管我可能会添加它们以保持一致性:)啊哈。。。是的,我在过去三年里只在c#这是一个纯粹的猜测,因为我对Razor只知道一点点,但是如果你在using中使用
@
前面的
@
符号,会发生什么呢?明白了!我怎么会错过呢?我想既然我是在代码中,我就不需要
@
来调用函数,这是真的,但显然你是为剃刀助手做的。@jpmc26,我想你说对了一半。我想他也需要()在VB.NET中不需要括号,尽管我可能会添加它们以保持一致性:)啊哈。。。是的,过去三年我都是在c#