[英]Html.BeginForm() in declarative helper methods
我試圖創建一個from
使用Html.BeginForm()
在剃刀輔助方法,在partial page (Razor)
中app_code
文件夾中。 但沒有成功。
@helper GenerateForm(...){
@using(@Html.BeginForm(.... // error
}
我嘗試添加System.web.mvc
或system.web.webpages
類的命名空間,但沒有區別。 是否可以在此代碼中使用此方法?
您應該將 HtmlHelper html 傳遞給這個助手並使用它:
helper GenerateForm(HtmlHelper html, ...){
@using(html.BeginForm(.... // error
}
試試這個:@using(Html.BeginForm(...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.