[Chris Sainty] Creating a Reusable, JavaScript-Free Blazor Modal
Grab the article at https://www.telerik.com/blogs/creating-a-reusable-javascript-free-blazor-modal
- Ensuring the Blazor Templates version is up to date:
dotnet new -i Microsoft.AspNetCore.Blazor.Templates
; - Newly created directory 'BlazorModal':
mkdir BlazorModal
; - Creating a new blazorlib:
dotnet new blazorlib
; - Creating a new blazor:
dotnet new blazor -n BlazorTest
;
- I was dealt with an error -
rzc generate exited with code 1
- which I assumed came from removing some elements of a fresh project early on though this error was reproduced also on the generating of a newblazor
project. Some suggestions from 2019 (and on earlier .NET Core builds) suggested suppressing the error with a@ref:suppressField
but I'm continuing to investigate; it turns out the installing of the latest Blazor Templates targets a stable version and not a preview, thus I needed to run a latest specific version install viadotnet new --install Microsoft.AspNetCore.Blazor.Templates::3.2.0-preview1.20073.1
(as of today 22nd October 2020); - There are core issues to be corrected here in this project due to versioning between Blazor.Templates versions, this is not a task I am undertaking at the present time due to the desire for understanding the framework via a learning curve rather than a complete refactoring exercise in upgrading a project. That task I will undertake at a later point;
- I learned about the
RenderFragment
(dependent onMicrosoft.AspNetCore.Blazor.RenderTree
) which 'Represents a segment of UI content, implemented as a delegate that writes the content to aMicrosoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder
'; - I learned about the
BlazorComponent
(dependent onMicrosoft.AspNetCore.Blazor.Components
) which is an 'Optional base class for Blazor components. Alternatively, Blazor components may implement Microsoft.AspNetCore.Blazor.Components.IComponent directly';
- In this guide, Chris Sainty helps you learn how to build a reusable modal without using any JavaScript for your Blazor and Razor applications;
Thanks goes out to Chris Sainty for the FREE stuff!
- Chris Sainty's Telerik profile ...Chris is a Microsoft MVP, software engineer and blogger with over 15 years experience working with ASP.NET...