Ikaso
Ikaso

Reputation: 2268

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.BeginForm 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?

Upvotes: 0

Views: 969

Answers (1)

Clicktricity
Clicktricity

Reputation: 4209

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

Upvotes: 1

Related Questions