分页后 Webgrid 复选框选择丢失
我有一个网络网格
@{
var gdAdminGroup = new WebGrid(source: Model, rowsPerPage: 20, ajaxUpdateContainerId: "tdUserAdminGroup");
}
@gdAdminGroup.GetHtml(
htmlAttributes: new { id = "tdUserAdminGroup" },
tableStyle: "gd",
headerStyle: "gdhead",
rowStyle: "gdrow",
alternatingRowStyle: "gdalt",
columns: gdAdminGroup.Columns(
gdAdminGroup.Column(columnName: "Description", header: "Admin Group"),
gdAdminGroup.Column(header: "", format: @<text><input name="chkUserAdminGroup" type="checkbox" value="@item.AdminGroupID" @(item.HasAdminGroup == 0? null : "checked") /></text>)
)
)
如果我选中一些复选框并转到第二页,则第一页上的选择将丢失。谁能帮我解决这个问题吗?谢谢
I have a webgrid
@{
var gdAdminGroup = new WebGrid(source: Model, rowsPerPage: 20, ajaxUpdateContainerId: "tdUserAdminGroup");
}
@gdAdminGroup.GetHtml(
htmlAttributes: new { id = "tdUserAdminGroup" },
tableStyle: "gd",
headerStyle: "gdhead",
rowStyle: "gdrow",
alternatingRowStyle: "gdalt",
columns: gdAdminGroup.Columns(
gdAdminGroup.Column(columnName: "Description", header: "Admin Group"),
gdAdminGroup.Column(header: "", format: @<text><input name="chkUserAdminGroup" type="checkbox" value="@item.AdminGroupID" @(item.HasAdminGroup == 0? null : "checked") /></text>)
)
)
If I check some checkboxs and goes to the second page, the selection on the first page will be lost. Can anyone help me with this? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
页面选择是链接为什么
- 页面通过 GET 命令刷新(< a href="...." 不是 < input type="submit" ....)
- 该链接未提交您复选框所在的表单,因此您无法读取复选框的状态。
您应该寻找 JavaScript 解决方案来修改 GET URL 中的复选框数据,
或者找到另一个网格生成器。
http://mvccontrib.codeplex.com/wikipage?title=Grid&ProjectName=mvccontrib
The Page selection is links why
- The page is refeshed via a GET command (< a href="...." not < input type="submit" ....)
- The link does not submit form in which you checkbox is in, why you can not read the state of the checkbox.
Either you should look for a JavaScript solution to amend the Checkbox data in the GET URL,
or find another Grid generator.
http://mvccontrib.codeplex.com/wikipage?title=Grid&ProjectName=mvccontrib