I have a the following code
@using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "update_panel", Url = "/Part/SearchPart" }))
{
<input type="text" placeholder="Search Parts"/>
<input type="submit" value="Search"/>
}
it outputs the following HTML
<form action="/Part" data-ajax="true" data-ajax-mode="replace" data-ajax-update="#update_panel" data-ajax-url="/Part/SearchPart" id="form0" method="post">
<input type="text" placeholder="Search Parts"/>
<input type="submit" value="Search"/>
</form>
and I would like to have the outputted HTML to have the ,form> tag to have the class=”pull-right”. How can I accomplish this?
You could use one of the overloads that allows you to specify html attributes::
Also I would more than strongly recommend you relying on the url of your form instead of hardcoding it in the
AjaxOptionsbecause when you deploy your application in a virtual directory chances are that your hardcoded/Part/SearchParturl will not work. Not to mention if you change your route patterns in Global.asax. So: