Skip to content

fix(demo): resolve DashboardGridDemo RenderFragment compile errors#294

Open
schalling wants to merge 1 commit into
blazorblueprintui:developfrom
schalling:fix/DashboardGridDemoCompileError
Open

fix(demo): resolve DashboardGridDemo RenderFragment compile errors#294
schalling wants to merge 1 commit into
blazorblueprintui:developfrom
schalling:fix/DashboardGridDemoCompileError

Conversation

@schalling
Copy link
Copy Markdown

Refactor data-driven widget rendering in DashboardGridDemo.razor to use valid RenderFragment helper methods instead of invalid Razor markup inside lambda switch arms. Preserves existing UI behavior while fixing Razor/C# parsing issues and restoring successful build.

Description

This PR fixes compilation errors in DashboardGridDemo.razor caused by invalid Razor markup inside C# lambda switch arms.
Changes made
• Refactored RenderDataDrivenWidgetContent to dispatch to dedicated RenderFragment helper methods:
• RenderBarChartWidget
• RenderAreaChartWidget
• RenderLineChartWidget
• RenderPieChartWidget
• RenderKpiWidget
• RenderTableWidget
• Kept the existing UI/content behavior intact while correcting Razor/C# structure.

Type of Change

  • [x ] Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Testing Checklist

  • [x ] Blazor Server
  • Blazor WebAssembly
  • Blazor Hybrid (MAUI)
  • Keyboard navigation / accessibility
  • Dark mode

Related Issues

Refactor data-driven widget rendering in DashboardGridDemo.razor to use valid RenderFragment helper methods instead of invalid Razor markup inside lambda switch arms.
Preserves existing UI behavior while fixing Razor/C# parsing issues and restoring successful build.
@mathewtaylor
Copy link
Copy Markdown
Contributor

mathewtaylor commented May 2, 2026

Hi @schalling, thanks for taking a look at this!

Quick question before we go further. When I check out develop and build the demo project locally, DashboardGridDemo.razor compiles cleanly with no errors. The __builder => { <Razor /> } lambda pattern that the file currently uses is valid Razor syntax and the compiler handles it fine on my end.

Could you share the specific compile error you were hitting, along with your .NET SDK version and IDE? Just want to make sure we understand what triggered this. If there's a real issue I'd like to get it fixed properly, but if it turns out to be environment-specific then the existing code might be okay as-is.

Thanks, Mathew

@bbunderson
Copy link
Copy Markdown

bbunderson commented May 3, 2026

I get errors building this page on both main and develop branches. I also tried VS and VS Code. At first we got compiler message that said you cannot have razor syntax in a switch statement, but now I get switched expression does not handle all possible values of its input type. (On the RenderDataDrivenWidgetContent content).

@schalling code worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants