开发者

Passing the form action attribute to a Partial View

I have a partial view that I am using from 2 different forms. In order to use jQuery validation I would like to use the tag instead of the Html.BeginFo开发者_StackOverflowrm helper. This means that I should specify the action attribute myself just like ASP.NET MVC 2 does when I call the Html Helpers. My questions are:

  1. How can I do it?
  2. Are there better ways to do what I want to do?


Its relatively easy, simply write your form tag as follows:

<form id="myform" method="post" action='<%= Url.Action("myAction") %>'>

If you are calliing the partial from separate places this is the easiest way to achieve what you want

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜