Blazor Display Raw Html
@Product.Description
@Product.Description
Onclick call function. Onclick using div
MainLayoutBase.cs MainLayout.razor IndexBase.cs Sources: https://docs.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters?view=aspnetcore-5.0
Example 1 index.html Note: Script tags should not be placed inside components because they cannot be updated dynamically. To fix this, move the script tag to the ‘index.html’ file or another static location. MainLayout.razor or in the MainLayoutBase.cs Example 2 Sources: https://www.syncfusion.com/faq/blazor/general/how-do-i-use-jquery-ui-components-in-a-blazor-application https://www.syncfusion.com/faq/blazor/javascript-interop/is-there-a-way-to-access-dom-in-blazor https://stackoverflow.com/questions/54274629/how-to-use-jquery-ui-from-blazor-component
Issue: Authenticate state does not update after login when in main layout page, therefore IsInRole function does not work. Workaround: Force the browser to refresh.
AuthenticationStateProvider AuthenticationState AuthenticationStateProvider vs AuthenticationState Blazor has a built-in service called AuthenticationStateProvider service. This service obtains authentication state data from ASP.NET Core’s HttpContext.User. This is how authentication state integrates with existing ASP.NET Core authentication mechanisms. It is this service that is used by AuthorizeView component and CascadingAuthenticationState component to get the authentication state. Don’t use AuthenticationStateProvider directly. Use the AuthorizeView component. The main drawback to using AuthenticationStateProvider directly... » read more
1. Create new field of string type in the AspNetUsers table of Identity database. 2. Add field to ApplicationUser class. (Server) 3. Create new class called CustomUserClaimsPrincipalFactory 4. Add to ConfigureServices in Startup.cs (Server) Note: As soon as the line .AddClaimsPrincipalFactory<CustomUserClaimsPrincipalFactory>(); is added, role does not work anymore.