0

How do you use a mvc helper method to create a ajax.beginform?

for ex:

@helper AjaxForm(string action, string controller, object routevalues, AjaxOptions options, params MvcHtmlString[] fields)
{
    // DOES NOT WORK
    @using(Ajax.BeginForm(action, controller, routevalues, options))
    {
        foreach (var field in inputfields)
        {
            @field
        }  
    }
}

I would like to use this field anywhere in my views like this

@helper AjaxForm("Action", "Controller", new {id = "1"}, new AjaxOptions())
tereško
  • 58,060
  • 25
  • 98
  • 150
Stian Standahl
  • 2,506
  • 4
  • 33
  • 43

1 Answers1

0

Like this

@using (Html.BeginForm())
{


}
Priyank
  • 1,353
  • 9
  • 13
  • This was not the problem i was trying to focus on. The problem is to get the real problem is to get the AjaxHelper into the method. – Stian Standahl Nov 29 '13 at 10:49