locked
Default page on subdirectory, hide on url for pagination using urldata[]. RRS feed

  • Question

  • User-352524747 posted

    I have a default page on a subdirectory called "subcategories". The default page displays data based on dropdown options selected from users.

    The url looks like this:

    /subcategories/default/alumni/1

    Is it possible to hide default from Url for pagination?

    Saturday, February 6, 2021 9:56 AM

Answers

All replies

  • User1535942433 posted

    Hi dow7,

    According to your description, could you tell us what's your project? Do you need pagination?

    Could you tell us more details to us?Or you could post your codes to us.

    Best regards,

    Yijing Sun

    Monday, February 8, 2021 6:33 AM
  • User-352524747 posted

    Yes, i need pagination. When I rename the page default.cshtml to something else, pagination works. 

    e.g. ~/edit/example/alumni/2 - works, I get pagination on example page in edit- subdirectory.

    e.g. ~/edit/default/alumni/2 - does not work. I get from database articles from alumni category. 2 is the second page, if there are more than 5 articles from this category iI use pagination. In this case it redirects to default page on the root.

    I have a route defined in _appstart.cshtml for default page in root.

    RouteTable.Routes.MapWebPageRoute("{url}", "~/default.cshtml", null, new { url = @"^[a-zA-Z0-9äöüÄÖÜß-]+$" }, "Default");

    Could this be a problem?

    Monday, February 8, 2021 1:11 PM
  • User1535942433 posted

    Hi dow7,

    According to your description and codes,I have created a test and I failed.So,I need to ask some details to solve your problems.

    1.Is your project MVC?

    2.How do you write the RouteTable? I have created a test and I couldn't match the method with parameters.

    I don't make sure your problem is RouteTable and I need you to post more details or codes to us.

    More details,you could refer to below article:

    https://docs.microsoft.com/en-us/dotnet/api/system.web.routing.routecollection.mappageroute?view=netframework-4.8

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 10, 2021 7:00 AM