Skip to main content

Using jQuery with ASP.NET Core Blazor

If you are following the progress of Blazor, 0.3.0 is the latest version to play with (at the time of writing this post). I created a CRUD app using blazor 0.1, and since then things have changed a lot like syntax for event handling and data binding, async event handlers, better encapsulation of component parameters and many others. One of the most important and unnoticed change is, including references of any third-party JavaScript library like jQuery and placing the JavaScript code. This post talks about using jQuery with ASP.NET Core Blazor and what’s new in 0.3 regarding JavaScript code. Read More

Fix for Blazor error BL9986: Component attributes do not support complex content (mixed C# and markup)

Blazor 0.3.0 was released recently, and I thought of upgrading one of my previously created Blazor CRUD app to the recent version 0.3.0. The Blazor app uses a JavaScript function to control the visibility of the HTML controls present in the Todo list element. The HTML elements inside the list are given a dynamic ID to have uniqueness. Like,

<input id="txt_@todo.ID" style="display:none;">

Here, the ID attribute contains C# and HTML markup. Unfortunately, this gives an error BL9986: Component attributes do not support complex content (mixed C# and markup) while compiling in 0.3.0 version. This is a very common use case in any application to manipulate or apply markup based on the server-side data like applying different CSS classes based on a C# variable. In the first place, I was wondering why Blazor is not allowing this and unfortunately, there is not much help available online to fix it. Read More

Update: Removed JavaScript dependency from the Blazor CRUD App

Yesterday I posted how to create a CRUD App using Blazor and ASP.NET Core and got a good response from folks on Facebook and Twitter. This Blazor app is using JavaScript for showing/hiding the HTML elements on the page. David Masterson on twitter pointed out that it can be done in another neat way that too without JavaScript and I thought of sharing with you (with his permission) how to update the same CRUD blazor app with no dependency on JavaScript. Read More

Create a CRUD App using Blazor and ASP.NET Core

Blazor is an experimental .NET web framework using C#/Razor and HTML that runs in the browser via WebAssembly. It simplifies the process of creating single page application (SPA) and at the same time also brings the power of .NET on the table. It runs in the browser on a real .NET runtime (Mono) implemented in WebAssembly that executes normal .NET assemblies. In this post, we’ll see how to set up blazor and create a CRUD app using blazor and ASP.NET Core. Read More