@using (Html.BeginForm("EmpLog", "Labels", FormMethod.Post))
{
@Html.DropDownListFor(x => x.SelectedValue, Model.Values, "----Select----", new { id = "ddlName", @class = "form-control col-md-6" })
<input type="submit" value="Search" id="btnSearch" class="btn btn-default" />
@{
var gridview = new WebGrid(source: Model.LstLog, rowsPerPage: 20, ajaxUpdateContainerId: "grid", canSort: false);
}
@if (Model.Lst != null)
{
@gridview.GetHtml(
htmlAttributes: new { id = "gridlogs" },
fillEmptyRows: false,
alternatingRowStyle: "alternate-row",
headerStyle: "grid-header",
footerStyle: "grid-footer",
selectedRowStyle: "grid-selected-row",
rowStyle: "grid-row-style",
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: "< Prev",
nextText: "Next >",
lastText: "Last >>",
columns: new[] {
gridview.Column("View", header: null, style: "click_able", format: @<text><a href="javascript:ViewFullDetails('@item.Id');">View</a></text>, canSort: false),
gridview.Column("JoinDate",header: "Join Date"),
gridview.Column("DeptName",header: "Dept Name"),
gridview.Column("Project",header: "Project")
}
)}
}
[HttpGet]
public ActionResult EmpLog()
{
model.Values = GetDDLInfo();
return View();
}
[HttpPost]
public ActionResult EmpLog()
{
model.Values = GetDDLInfo();
model.LstLog= GetLogInfo();
return View(model);
}
我对WebGrid不够好,请帮助我应用分页。
答案 0 :(得分:1)
我已添加以下代码来处理分页
$('th a, tfoot a').click(function () {
$('form').attr('action', $(this).attr('href')).submit();
return false;
});