I am new to grid.mvc.I want to show only starting 2-3 grid pages and the last page.like with page sizes
but its coming like this
my code is-
public ActionResult VendorOrderListPartial()
{
var model = VendorManager.GetAllVendorOrders();
ViewBag.paging = GlobalSettingsInfo.GridPageSize;
var grid = this.gridMvcHelper.GetAjaxGrid(model.AsQueryable().OrderByDescending(x => x.OrderId));
return View("VendorOrderListPartial", grid);
}
@Html.Grid(Model).Named("VendorOrderListPartial").Columns(columns =>
{
columns.Add(c => c.OrderNo).Titled("Ord#").Filterable(true);
columns.Add(c => c.OrderDate).Format("{0:dd/MM/yyyy}").Titled("Order Date").Filterable(true);
columns.Add(c => c.ProdStatus).Titled("Prod.Status").Filterable(true);
columns.Add(c => c.OrderAmount).Titled("Total Amount").Filterable(true);
columns.Add().Titled("View").Filterable(false).RenderValueAs(o => Html.ActionLink("View", "VendorOrderDetailView", "WebVendor", new { id = o.OrderId }, null)).Encoded(false).Sanitized(false);
}).WithPaging(@ViewBag.paging).Sortable(true)
any help will be appreciated..Thanks
I had the same issue and I found a solution.
I'm assuming that you are using the grid.mvc with ajax. In _AjaxGridPager.cshtml , check Model.PagePartitionSize property.
If Model.PagePartitionSize = 0, set it to 10 for instance.
EDIT In your controller, after you initialize a gridMvcHelper.GetAjaxGrid object, you change the property.
Example
var grid = gridMvcHelper.GetAjaxGrid<question>((IOrderedQueryable<question>)QuestionsAfterSearch.OrderByDescending(x => x.idQuestion).AsQueryable(), page);
grid.AjaxGridSettings.PagePartitionSize = 10;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.