I have a registration form which I want to put an id
@using (Ajax.BeginForm("Registrar", new AjaxOptions
{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "div_tabla_sucursal",
OnSuccess = "Limpiar"
},
new { @id="frmRegistro" }))
{
<div id="div_formulario_registrar_sucursal">
@Html.Partial("_ListaFormularioRegistrarSucursal", Model.Modelo_Sucursales)
</div>
}
But when I added it it generates the following
I also have another form which does not generate that error
@using (Ajax.BeginForm("Filtrar", "Usuario", null,
new AjaxOptions
{
HttpMethod = "POST",
UpdateTargetId = "Div_Tabla_Usuarios",
InsertionMode = InsertionMode.Replace
}, new { @id = "frmFiltrarNombrePersona" }))
{
@Html.Label("Ingrese el nombre de la persona")
@Html.TextBox("NombrePersona", null, new { @class = "form-control" })
<div id="Div_Tabla_Usuarios">
@Html.Partial("_TablaUsuarios", Model)
</div>
}
In examples that I have looked for, he presents them to me in the same way.
When you use the overload of BeginForm with three parameters (as you did), the third is an object of class AjaxOptions and in your code it is a String. Signatures can be
(String, String, AjaxOptions)
or(String, Object, AjaxOptions)
and yours is(String, AjaxOptions, String)
. The example you posted has four parameters,(String, String, AjaxOptions, AjaxOptions)
(the third in the example is null.)