PagedListPager传递其他模型数据
我有以下型号:
public class PagedClientViewModel { public int? Page { get; set; } public PagedList.PagedList Clients { get; set; } public bool ShowAllClients { get; set; } }
ShowAllClients是一个复选框,我将用它来进一步过滤从服务器返回的客户端列表。
@Html.CheckBoxFor(model => model.ShowAllClients, new { id = "ShowAllClientsCheckbox" })
这是我的寻呼机:
@Html.PagedListPager(Model.Clients, page => Url.Action("Index", new { Page = page }), PagedListRenderOptions.DefaultPlusFirstAndLast)
寻呼机和复选框都在同一表格上。
我遇到的问题是,当我在寻呼机控件上更改页面时,复选框始终设置为false。 发生这种情况是因为在Index操作中,ShowAllClients设置为false。
更改页面时如何保留复选框数据?
我得到了以下工作:
@Html.PagedListPager(Model.Clients, page => Url.Action("Index", new PagedClientViewModel { Page = page, ShowAllClients = Model.ShowAllClients }))
- FluentValidation:检查两个字段中的一个是否为空
- MVC中的Summernote和表单提交c#
- Razor HTML Helpers在Nop Commerce插件中提供智能感知错误
- 在使用MVCContrib对unit testingMVC 3控制器和视图进行unit testing时,向RouteData添加键和值
- 如何更改ASP.NET MVC中的int模型validation的ErrorMessage?
- Request.IsAuthenticated总是错误的
- 问题使用具有多个配置的msbuild构建单个项目
- FormsAuthentication.Decrypt始终在其中一个Web服务器中返回null
- 用户角色/授权在ASP.NET标识中不起作用