Reputation: 89
I have a RazorPages application and it's index page has a list of items. I want this page to show only 50 elements of list and decide what items to show using GET parameter, for example if I pass ?page=2
to page it must display elements from 51 to 100
As I have found, I can handle this type of request in OnGet
like that:
public void OnGet(int page)
But when I open page - the page
parameter in OnGet
is always 0 even if I pass '?page=2' or something like this
I tried also using string instead of int and always got "/Index"
What is the correct way to handle these parameters in OnGet?
Upvotes: 1
Views: 2458
Reputation: 43959
Try to add in you page view
@page "{pageNum:int?}"
and model
public void OnGet(int? pageNum)
Upvotes: 2