S
S
Sergey Melnikov2017-10-14 12:12:27
ASP.NET
Sergey Melnikov, 2017-10-14 12:12:27

How to change the number of displayed pages in WebGrid asp.net mvc?

By default, the GridView displays posts with links to 5 pages. How to make links to pages more than 5?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nemiro, 2017-10-16
@azazel_live

@{ 
  var grid = new WebGrid(/*...*/);
}

@grid.GetHtml(mode: WebGridPagerModes.Numeric, numericLinksCount: 10)

или отдельно список страниц:

@grid.Pager(numericLinksCount: 10)

https://msdn.microsoft.com/en-us/library/system.we...
public IHtmlString GetHtml(
  string tableStyle,
  string headerStyle,
  string footerStyle,
  string rowStyle,
  string alternatingRowStyle,
  string selectedRowStyle,
  string caption,
  bool displayHeader,
  bool fillEmptyRows,
  string emptyRowCellValue,
  IEnumerable<WebGridColumn> columns,
  IEnumerable<string> exclusions,
  WebGridPagerModes mode,
  string firstText,
  string previousText,
  string nextText,
  string lastText,
  int numericLinksCount,
  Object htmlAttributes
)

Type: System.Int32
The number of numeric links to the next WebGrid pages . The text of each digital page link contains the page number. Set the mode parameter 's Numeric flagto display these controls on the page.

https://msdn.microsoft.com/en-us/library/system.we...
public HelperResult Pager(
  WebGridPagerModes mode,
  string firstText,
  string previousText,
  string nextText,
  string lastText,
  int numericLinksCount
)

Type: System.Int32
The number of numeric page links to display. The default value is 5 .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question