MVC 3 中用于查看列表的保存按钮
在MVC3视图中,我有一个由RadioButtons制作的表,由entityObject填充:
@model IEnumerable<Table> (View is made as "List")
下面我添加了一个回发“保存”按钮:
@using (Html.BeginForm("Save", "MyView", FormMethod.Post, new { ent = Model }))
{
<input type="submit" value="Save" />
}
并且在控制器中我添加了:
[HttpPost]
public ActionResult Save(List<Table> ent)
{
// do something
}
但不正确。如何更正代码以返回控制器端的所有列表。 谢谢。
In MVC3 view i have a table made by RadioButtons populated by entityObject:
@model IEnumerable<Table> (View is made as "List")
Below i added a postBack "Save" button:
@using (Html.BeginForm("Save", "MyView", FormMethod.Post, new { ent = Model }))
{
<input type="submit" value="Save" />
}
And in controler i added:
[HttpPost]
public ActionResult Save(List<Table> ent)
{
// do something
}
But is not right. How to correct the code to return all list in controler side.
Thx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加正确的代码来在视图中编写单选按钮,否则它们将永远不会在您的发布请求中提交。
顺便说一句,回发是 Webform 中使用的术语,而不是 MVC 中使用的术语。
ASP.NET MVC:回发仍然在这里 得票最多的答案提供了答案。
You need to add the proper code to write the radio buttons in the view, otherwise they will never be submitted in your post request.
By the way, postback is a term used in webforms and not MVC.
The most voted answer for ASP.NET MVC: Is postback still here provides an answer.