MVC3

zsp499519140 2012-09-26 03:07:38
@using (Html.BeginForm("Index", "Financlal", FormMethod.Post, new { id = "form_financlal_info" }))
{
@Html.Hidden("CarID$guid$key",carID)

<table>
<thead>
<tr>
<td>加邮费:<input type="text" value="@Common.GetValue(row, "Jiayoufei")" /></td>
<td>占标费:@Common.GetValue(row, "Zhanbiaofei") </td>
<td>采购成本:@Common.GetValue(row, "Caigouchengben")</td>
</tr>
</thead>
</table>
<input type="submit" value="保存" />
}
后台
[HttpPost]
public JsonResult Info(FormCollection form)
{
Dictionary<string, object> forms = new Dictionary<string, object>();
form.CopyTo(forms);
forms.Add("FinanciaID$guid", GetUserID());

DataResult<Guid> result = BLL.Financlal.FinanclalFn.SaveInfo(forms);

return Json(result, JsonRequestBehavior.AllowGet);
}
为什么我点了页面的保存按钮它根本不走后台的方法
...全文
124 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bdmh 2012-09-26
  • 打赏
  • 举报
回复
Html.BeginForm第一个参数是Action,第二个是Controller,就是Financlal中的Index方法,所以你的 Info改成Index,或者将第一个参数改为 Info
xml111024 2012-09-26
  • 打赏
  • 举报
回复
@using (Html.BeginForm("Index", "Financlal", FormMethod.Post, new { id = "form_financlal_info" }))

提交到controller="financlal" ,action="index"

你后台的action="Info",所以把Index替换为Info。
zsp499519140 2012-09-26
  • 打赏
  • 举报
回复
纳尼?没人回答MVC3的?

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧