Skip to main content

Posts

Showing posts with the label Blazor Server

Blazor Server CRUD Operation Using MudBlazor UI Components[.NET6]

In this article, we are going to implement CRUD operation in .NET6 Blazor Server application using the MudBlazor UI components. Blazor Server: Blazor Server is a single-page application. At the server, a pre-rendered HTML output of the page will be delivered to the user browsers. Any UI update, event handling, javascript calls will carry over by a SingnalR connection to the server. So application updates are depending on the continuous connection of the SignalR. So Blazor server is a single-page application that can be made of C#. Since the blazor server only outputs the pre-rendered HTML to the client, so there is no c# code downloading into user browsers like in Blazor WebAssembly(c# code downloaded and run in the browser for blazor webassembly application). SignalR Connection: A Blazor Server application works over a SignalR connection. A Blazor Server application creates a UI State memory at the server which will be interacted by the SignalR connections. If a SignalR conn

.NET5 Blazor Server CRUD Operation Using Entity Framework Core

In this article, we are going to implement CRUD operations in .Net5 Blazor Server application. Blazor Server: Blazor Server is a single-page application. At the server, a pre-rendered HTML output of the page will be delivered to the user browsers. Any UI update, event handling, javascript calls will carry over by a SignalR connection to the server. So application updates or depends on the continuous connection of the SignalR. So Blazor Server is a single-page application that will be made of c#. Since the blazor server only outputs the pre-rendered HTML to the client, so there is no c# code downloading into user browsers like in Blazor Webassembly(c# code downloaded and runs in browser for blazor webassembly application). Role Of SignalR Connection: A Blazor Server application works over a SignalR connection. A Blazor Server application creates a UI State memory at the server which will be interacted by the SignalR connections. If a SignalR connection got interrupted, then the clie

A Sample On Blazor Server Form Validation Using Validator Component

In a form to validate values against data store or database in a blazor server application, we can achieve this by creating a custom blazor component that can be called a Custom Validator Component. Here our Validator Component is not a built component, here we make a plain class as a component by inheriting 'Microsoft.AspNetCore.Components.ComponentBase', and then we use built-in blazor form components and make it as Custom Validator Component. Our Custom Validator Components mainly built on form components like 'Microsoft.AspNetCore.Components.Forms.ValidationMessageStore' and 'Microsoft.AspNetCore.Components.Forms.EditContext'. Create A Blazor Server Application: Let's understand our topic more in-depth by making a sample on it, so let's create a Blazor Server sample application. Here my sample targeted framework is '.Net5'.Most recommended IDE's for development in Visual Studio 2019(Version 16.8.* that supports .Net5) or  Visual Studio Co

Split HTML And C# Code In Blazor Using Either Partial Class Or ComponentBase Class

By default Blazor component file consists of HTML code and C# code under the single file. For better coding standards we can split HTML code and C# code to separate files using concepts like: Partial Class ComponentBase Class Create Sample Blazor Server Application: Blazor Single Page Application comes with two types of templates like  (1) Blazor Server,  (2) Blazor Web Assembly . Let's create a Blazor Server templated sample application to understand to split the *.razor(Blazor file extension) files.  Using Visual Studio 2019 using a rich user interface we can create Blazor Templated application very easily. But for this sample, I'm using .Net Core CLI(Command Line Interface) with Visual Studio Code IDE.   Click to know how to use Visual Studio Code Editor for .Net Core applications . .Net Core Blazor Server CLI Command:- dotnet new BlazorServer -n Your_Application_Name Blazor project preview:- Open a command prompt whose path needs to be pointed to the  Startup.cs file