Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.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 声明性帮助程序方法中的Html.BeginForm()_Asp.net_Asp.net Mvc 3_Html Helper_Razor Declarative Helpers - Fatal编程技术网

Asp.net 声明性帮助程序方法中的Html.BeginForm()

Asp.net 声明性帮助程序方法中的Html.BeginForm(),asp.net,asp.net-mvc-3,html-helper,razor-declarative-helpers,Asp.net,Asp.net Mvc 3,Html Helper,Razor Declarative Helpers,我正试图在部分页面(razor)文件夹中的部分页面(razor)中的razor助手方法中使用Html.BeginForm()从创建。但是没有成功 @helper GenerateForm(...){ @using(@Html.BeginForm(.... // error } 我尝试添加名称空间,如System.web.mvc或System.web.webpages,但没有区别。 是否可以在此代码中使用此方法?尝试以下方法:@using(Html.BeginForm(…您应该将Html

我正试图在
部分页面(razor)
文件夹中的
部分页面(razor)
中的razor助手方法中使用
Html.BeginForm()
创建
。但是没有成功

@helper  GenerateForm(...){

 @using(@Html.BeginForm(.... // error

}
我尝试添加名称空间,如
System.web.mvc
System.web.webpages
,但没有区别。
是否可以在此代码中使用此方法?

尝试以下方法:@using(Html.BeginForm(…

您应该将HtmlHelper Html传递给此帮助程序并使用它:

helper  GenerateForm(HtmlHelper html, ...){

    @using(html.BeginForm(.... // error

}

HtmlHeLper的可能副本不是null,但它不包含它在viewwell中的所有方法,下面是我使用HtmlHeLper的一个好代码示例:@using(Html.BeginForm(“Upload”,“Upload”,FormMethod.Post,new{enctype=“multipart/form data”})){@Html.ValidationSummary(true)选择一个文件}