1
There is some performance gain when using jQuery to perform ajax requests relative to the post using Html.Beginform?
@using (Html.BeginForm("Create", "Teste")
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Nome, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Nome, new { @class = "form-control" })
<span class="help-block">@Html.ValidationMessageFor(model => model.Nome, "", new { @class = "text-danger" })</span>
}
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Enviar" />
</div>
</div>
If it is better to do it via ajax request, have some sample code where it deals with Validationsummary and Validationmessagefor?
My question is not about HTML.Beginform itself, but how the request is made.
– b3r3ch1t
This is set up in both ways. But both will by default make an HTTP POST Request. So in the end, they do exactly the same thing.
– Thiago Lunardi