Skip to content

[11.0 P5] QuickGrid SSR support #37102

Closed

Description

@guardrex

Description

@dariatiurina ... I'll write it up for the release notes (unless Dan prefers that you do it) and take care of the article updates (again, unless Dan is asking you to take care of it). Either way, let's use this docs issue to track the work, which is on the docs .NET 11 release tracker now.

UPDATE (5/14): You can place the coverage in an issue comment here. I'll take care of creating the PR, and then I'll ping you for review. Also, you don't have to sweat the What's New blurb and cross-link to the coverage. I'll take care of the What's New article.

PU PR: dotnet/aspnetcore#65451

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/components/quickgrid?view=aspnetcore-10.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/quickgrid.md

Document ID

564e71e3-82ed-ce23-4f9f-a00a58734a62

Platform Id

b429ef55-e688-0665-b1f6-28926c46b482

Article author

@guardrex

Metadata

  • ID: 564e71e3-82ed-ce23-4f9f-a00a58734a62
  • PlatformId: b429ef55-e688-0665-b1f6-28926c46b482
  • Service: aspnet-core
  • Sub-service: blazor

Related Issues

Activity

  1. added
    Source - Docs.ms
    on May 5, 2026
  2. moved this from Triage to 11.0 in Blazor.Docson May 5, 2026
  3. added
    11.0
    and removed
    Source - Docs.ms
    on May 5, 2026
  4. deleted a comment from github-actions on May 5, 2026
  5. dariatiurina commented on May 25, 2026

    @dariatiurina
    Contributor

    @guardrex I don't know where to put my write-up, so posting it here:

    Pagination modes

    QuickGrid supports two pagination and sorting modes: URL-based navigation (default in .NET 11+) and inner-state navigation (default before .NET 11).

    URL-based navigation

    Pagination and sort state is persisted in the URL query string. When users paginate or sort, the URL updates (e.g. ?page=2&sort=Name&order=asc). This enables link sharing, browser back/forward, and static SSR without interactivity.

    Sortable column headers and paginator controls render as <a> elements with href attributes. The StaticHtmlRenderer renders these anchors, and on each request the server reads the query string to determine current page and sort state — no JavaScript runtime needed.

    Query string parameters:

    • page — 1-based page number. Page 1 omits the parameter for clean URLs.
    • sort — column title to sort by.
    • order — asc or desc.

    The sort column is identified by the column's Title property. Columns without a Title render a non-clickable <div> header.

    QuickGrid reads the URL on initialization and subscribes to NavigationManager.LocationChanged, so browser back/forward and direct URL entry work. When sort parameters are removed from the URL, it falls back to the default sort column/direction.

    Disabled paginator links use aria-disabled="true" and pointer-events: none instead of the HTML disabled attribute (which doesn't exist on <a> elements).

    Inner-state navigation

    Before .NET 11, pagination and sort state is managed in memory inside QuickGrid without changing the URL. An interactive render mode is required.

    Multiple grids on the same page

    Multiple QuickGrid components on the same page need unique QueryParameterNamePrefix values to avoid query string conflicts. The default prefix is "", producing parameters named page, sort, order. Setting a prefix like "cities" produces cities_page, cities_sort, cities_order.

    Each QuickGrid must have its own PaginationState instance. Multiple grids must not share a PaginationState if they have different prefixes — the last grid to render overwrites the query parameter name on the shared state, causing the Paginator to read from the wrong parameter.

    Example URL with two grids: ?page=2&sort=Name&order=asc&cities_page=3&cities_sort=Country&cities_order=desc.

    Disabling URL-based navigation

    Set the AppContext switch to false:

    AppContext.SetSwitch(
        "Microsoft.AspNetCore.Components.QuickGrid.EnableUrlBasedQuickGridNavigationAndSorting",
        false);

    This restores <button> elements with @onclick handlers. An interactive render mode is required.

    The switch only controls the rendered HTML element (<a> vs <button>). Even when disabled, QuickGrid still reads/writes state to the URL query string internally — SortByColumnAsync navigates via NavigationManager.NavigateTo regardless of the flag, and Paginator.GoToPageAsync does the same. This is verified by QuickGridInteractiveCompatTest.

    The feature flag is implemented in QuickGridFeatureFlags.cs. It defaults to true when the switch is not set (!AppContext.TryGetSwitch(...) || isEnabled).

    Sort by column

    Add Sortable="true" to a PropertyColumn. With URL-based navigation, clicking a header navigates to a URL with updated sort and order params. Without it, clicking fires @onclick which calls SortByColumnAsync. In both cases, SortByColumnAsync navigates via NavigationManager.NavigateTo(GetSortQueryStringUrl(...)), so the URL always reflects sort state.

    Title-based sort identification

    Sort state in the URL uses the column's Title property as the identifier — the sort query parameter is set to column.Title (e.g. ?sort=Name&order=asc). On URL change, QuickGrid matches the sort value back to a column by doing _columns.FirstOrDefault(c => c.Title == sort.ColumnTitle). If no column matches, the sort is ignored and the grid falls back to its default sort.

    This means renaming a column's Title is a URL-breaking change. Any bookmarked or shared URLs containing the old title in the sort parameter will stop matching, and the grid will silently fall back to the default sort instead of sorting by the intended column. For PropertyColumn, the Title defaults to the property name (e.g. Property="@(p => p.FirstName)" produces Title="First Name"), so renaming the property or explicitly changing the Title parameter both break existing URLs.

    Paginator

    Paginator injects NavigationManager, subscribes to LocationChanged, and reads the page index from the query string on every location change. GoToPageAsync navigates to the target URL rather than directly mutating PaginationState — state is updated through the LocationChanged callback flow.

    GetPageUrl returns a URL with the 1-based page number. Page index 0 (page 1) omits the query parameter entirely.

    CSS breaking change

    When URL-based navigation is enabled, selectors targeting button.col-title need to also target a.col-title, and nav button / nav button:disabled need nav a / nav a[aria-disabled="true"]. The built-in QuickGrid CSS already covers both.

  6. guardrex commented on May 25, 2026

    @guardrex
    CollaboratorAuthor

    This is great, @dariatiurina ... I'll take it from here and ping you on the PR.

  7. moved this from 11.0 to In progress in Blazor.Docson May 29, 2026
  8. dariatiurina commented on Jun 9, 2026

    @dariatiurina
    Contributor

    @guardrex Hi! Dan asked me for migration doc for QuickGrid (dotnet/aspnetcore#65451) and since we were working on the docs for it here, I will ask you here. If it's wrong place, just point me in the right direction, please.

    So, in #37206 we mentioned breaking changes, but we didn't mention that CSS styles will be broken for people who update to 11, because default is not links instead of buttons. Do we need to mention it there, or is there somewhere else that it need to go to?

  9. guardrex commented on Jun 9, 2026

    @guardrex
    CollaboratorAuthor

    @dariatiurina ... Yes, we have migration articles here. You can submit a PR (or I'll do it if you want to provide the content) to this markdown file ...

    https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/migration/100-to-110/includes/blazor.md

    What I need to do, and I'll do it on the Preview 5 What's New PR, is hook that file up into the ToC so that it shows up. It wasn't done before simply because we didn't have the .NET 11 version selector set up for the articles when the migration content was generated. I will take care of getting the content on the ToC right now for today's Preview 5 release.

    If you want me to drop the QuickGrid migration content into that file, you can just place it into an issue comment here. I'll also add it on the existing PR. Otherwise, open a PR against that file ☝️ for it, and I'll review and merge it. The ToC will be handled on the existing What's New PR ... I will take care of that right now.

  10. guardrex commented on Jun 9, 2026

    @guardrex
    CollaboratorAuthor

    BTW WRT an actual "breaking changes" content. We do write that up (usually), but I don't think it's been done yet. It would go under the What's New node. An example would be the content we had for .NET 10 last year, which you can see here ...

    https://learn.microsoft.com/en-us/aspnet/core/breaking-changes/10/overview?view=aspnetcore-10.0

    Usually, the team takes care of generating that from breaking changes elsewhere ... not sure if it comes from the framework repo (label filtering or something) or from the .NET Core docs. I don't recall ever working it myself, so I'm not sure. I think it's automatically generated somehow.

    I think what Dan is talking about is Migration content. If so, we just need to get the content into that markdown file that I cross-linked ☝️ .... AND I need to get that on the ToC today ... I'll set that up right now.

  11. guardrex commented on Jun 9, 2026

    @guardrex
    CollaboratorAuthor

    Got IT! ...

    febe9fa

  12. moved this from In progress to Done in Blazor.Docson Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions