我想在app_code
文件夾中的partial page (Razor)
剃刀輔助方法,使用Html.BeginForm()
創建一個from
。但沒有成功。Html.BeginForm()在聲明輔助方法
@helper GenerateForm(...){
@using(@Html.BeginForm(.... // error
}
我嘗試添加命名空間像System.web.mvc
或system.web.webpages
但沒有什麼區別。 是否有可能使用這個方法在這個代碼?
可能重複的是,爲什麼爲HtmlHelper比如在空Razor聲明式@helper方法?](http://stackoverflow.com/questions/5282655/why-is-the-htmlhelper-instance-null-in-a-razor-declarative-helper-method) – nemesv
HtmlHeLper不爲null但它並不包含所有的方法,因爲它在視圖 –