html.beginform 提交表单,c# - Ajax.BeginForm inside Html.BeginForm - Stack Overflow

I have a view that is used for editing stuff, say Orders. Orders have line items that can be added arbitrarily. So a main view and nested partialviews.

Each partial should have an ajax form for tweaking quantities of each line item or whatever.

Thus:

Html.BeginForm()

{%>

Ship to: blah blah blah

Ajax.BeginForm("EditLineItem", "Order", new { OrderLineItemID = Model.ObjectID }, itemAjaxOptions))

{

Item qty blah blah blah

}

%>

}

I have a controller that looks like this:

[ActionName("Edit")]

[AcceptVerbs(HttpVerbs.Post)]

[ValidateAntiForgeryToken]

public ActionResult Edit(int orderID)

{

blah, blah

}

[ActionName("EditLineItem")]

[AcceptVerbs(HttpVerbs.Post)]

[ValidateAntiForgeryToken]

public ActionResult EditLineItem(Guid orderLineItemID)

{

blah, blah

}

My trouble is that when I submit the Ajax form, I get the Edit method instead of the EditLineItem methods. Both routes are mapped. Is there some gotcha like "you can't submit an Ajax form inside of an Html form" that I don't know about?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值