Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I have an umbraco 8 website, I'm in the process of moving this over to Umbraco 10 but I'm failing with getting pageination to work.
This is my string for umbraco 8
if (!int.TryParse(Request.QueryString["page"], out page))
But I get
The name 'Request' does not exist in the current context
What would I replace this with?
Thanks
Hi Matt,
While I do not really know what I'm doing 😁, I have managed to figure out how to grab stuff from the query string, as that's also a frequent part of my partials.
You'll need this injection at the top of the file:
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor;
Then you'll need something like this to make stuff easier to read:
var httpContext = HttpContextAccessor.HttpContext;
Finally, to grab the value of page, you can do:
page
var page = httpContext.Request.Query["page"];
(which you can probably wrap in the TryParse construct).
Hope that helps,
/Chriztian
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Pageination with umbraco 10
Hi
I have an umbraco 8 website, I'm in the process of moving this over to Umbraco 10 but I'm failing with getting pageination to work.
This is my string for umbraco 8
But I get
What would I replace this with?
Thanks
Hi Matt,
While I do not really know what I'm doing 😁, I have managed to figure out how to grab stuff from the query string, as that's also a frequent part of my partials.
You'll need this injection at the top of the file:
Then you'll need something like this to make stuff easier to read:
Finally, to grab the value of
page
, you can do:(which you can probably wrap in the TryParse construct).
Hope that helps,
/Chriztian
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.