mvc ajax提交html标签,Ajax.BeginForm里面有Html.BeginForm多个提交按钮mvc

我在页面上嵌套了表单。

@using (Html.BeginForm())

{

@Html.TextBoxFor(model => model.ComapnyName, new { @class = "form-control", placeholder = @Resources.Customers.ComapnyName })

@Html.ValidationMessageFor(model => model.PhoneNuComapnyNamember, "", new { @class = "text-danger" })

// other stuff

Add

//bootstrap modal

@using (Ajax.BeginForm("CreateCustomersDepartments", "Customers", null, new AjaxOptions

{

HttpMethod = "Post",

UpdateTargetId = "departmentsId",

OnSuccess = "$('#departmentsModal').modal('hide')"

}))

{

@Html.TextBoxFor(model => model.Name, new { @required = "require", @class = "form-control", placeholder = Resources.Common.Name })

@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })

// other stuff

//Create departments

}

//Create company

}

当我单击“提交”按钮(“为主窗体创建”)时,需要验证器保持字段来自模态(depoartments add)。我从添加部门开始,然后单击modalpopup上的提交按钮,主窗体保留验证器。

我试过

但页面无效代码未来到控制器。

在asp.net(网络表单)上我使用validationGroup,如何获得相同的效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值