How do I create a strongly typed BeginForm?

前端 未结 2 1709
长发绾君心
长发绾君心 2021-01-20 19:59

I\'ve seen a few examples of people using this syntax for HTML.BeginForm:

(Html.BeginForm(action => action.ActionName(id)))

2条回答
  •  死守一世寂寞
    2021-01-20 20:31

    You will find this extension methods in MVCContrib and more specifically in the Microsoft.Web.Mvc.dll assembly in the Microsoft.Web.Mvc.FormExtensions class. So download and include this assembly in your project and add the Microsoft.Web.Mvc namespace in the namespaces section of your web.config file:

    
        
        
        
        
        
        
        
    
    

    and you will be able to use it in your views.

提交回复
热议问题