what is the use of RouteValueDictonary routeValues in Html.BeginForm()

前端 未结 2 2019
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-19 11:27
@{
    ViewBag.Title = \"About Us\";
}

@using (Html.BeginForm(new RouteValueDictionary { {\"Action\",\"Index\"}}))
{
         


        
2条回答
  •  执笔经年
    2020-12-19 11:57

    The route value dictionary simply allows flexibility in defining the location that the form will POST to. Not everyone stops at controller/action. For example, let's say that I wanted my form to post to /Area/Controller/FormProcessor/Action/Parameter1/Parameter2. I cannot do this by using the simple Html.BeginForm("Action", "Controller") method.

提交回复
热议问题