https://blazor.syncfusion.com/documentation/getting-started/server-side-blazor/

Note: Starting with version 17.4.0.39 (2019 Volume 4), you need to include a valid license key (either paid or trial key) within your applications. Please refer to this help topic for more information.

New: Syncfusion Blazor components are compatible with .NET 5.0 RC and it requires Visual Studio 2019 16.8 Preview 3 or later.

Importing Syncfusion Blazor component in the application

  • Now, install Syncfusion.Blazor NuGet package to the newly created application by using the NuGet Package Manager. Right-click the project and select Manage NuGet Packages.
  • Search Syncfusion.Blazor keyword in the Browse tab and install Syncfusion.Blazor NuGet package in the application.
  • The Syncfusion Blazor package will be installed in the project, Once the installation process is completed.
  • Open ~/_Imports.razor file and import the
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Calendars
  • Open the ~/Startup.cs file and register the Syncfusion Blazor
using Syncfusion.Blazor;

namespace WebApplication1
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            ....
            ....
            services.AddSyncfusionBlazor();
        }
    }
}

For Blazor WebAssembly use Program.cs in Main function…

builder.Services.AddSyncfusionBlazor();
  • Add the Syncfusion bootstrap4 theme in the <head> element of the ~/Pages/_Host.html page.
<head>
    ....
    ....
    <link href="_content/Syncfusion.Blazor/styles/bootstrap4.css" rel="stylesheet" />
</head>
  • Now, add the Syncfusion Blazor components in any web page (razor) in the ~/Pages folder. For example, the Calendar component is added in the ~/Pages/Index.razor page.
<SfCalendar TValue="DateTime"></SfCalendar>
  • Run the application, The Syncfusion Blazor Calendar component will render in the default web browser.

Removing the Trial Version Message

https://help.syncfusion.com/common/essential-studio/licensing/license-key?_ga=2.238264457.840701722.1607217368-1394618005.1606092282#blazor

For Server side application

Register the license key in Configure method of Startup.cs

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    //Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Error");
        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
        app.UseHsts();
    }

    app.UseHttpsRedirection();
    app.UseStaticFiles();

    app.UseRouting();


    app.UseEndpoints(endpoints =>
    {
         endpoints.MapBlazorHub();
         endpoints.MapFallbackToPage("/_Host");
    });
}

For Client side application

Register the license key in main method of Program.cs

using Syncfusion.Blazor;
public static async Task Main(string[] args) 
{ 
    //Register Syncfusion license 
    Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");  
    var builder = WebAssemblyHostBuilder.CreateDefault(args); 
    builder.RootComponents.Add<App>("app");                               
    builder.Services.AddSyncfusionBlazor(); 
    await builder.Build().RunAsync(); 
}
Last modified: February 28, 2021

Author

Comments

Write a Reply or Comment