От: | Glestwid | ||
Дата: | 19.05.16 07:46 | ||
Оценка: |
[OutputCache(Location = OutputCacheLocation.Any, VaryByParam = "none", Duration = 60)]
public ActionResult Index(string country = null, string city = null, string companyName = null, int page = 1, int pageSize = 5, string sort = "ContactName", string sortdir = "DESC")
{
var allCustomers = service.GetCustomers(country,city,companyName);
return View(allCustomers);
}
@using (Html.BeginForm("index", null, FormMethod.Get))
{
<div style="margin-top:17px;">
@{
var grid = new WebGrid(
canPage: true,
rowsPerPage: Model.PageSize,
canSort: true,
ajaxUpdateContainerId: "grid");
grid.Bind(Model.Content, rowCount: Model.TotalRecords, autoSortAndPage: false);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(htmlAttributes: new { id = "grid" },
fillEmptyRows: false,
tableStyle: "table table-bordered table-hover",
mode: WebGridPagerModes.All,
columns: grid.Columns(
grid.Column("CustomerID", "CustomerID"),
grid.Column("CompanyName", "CompanyName"),
grid.Column("ContactName", "ContactName"),
grid.Column("City", "City", style: "col-lg-3"),
grid.Column("Country", "Country", style: "col-lg-3")
));
}
</div>
}