ASP.NET Blazor Server call Web Api
This blog article shows you one of the possible way for ASP.NET Blazor Server to call ASP.NET Web Api. First, both side is having the below object.
Creating Blazor Material Navigation Menu
In the previous article, we’ve integrated MudBlazor into our Blazor WebAssembly application and started working with some material components and theme modification. But our navigation menu doesn’t look great. Well, to be honest, we didn’t do anything with it. That said, in this article, we are going to create a new Blazor material navigation menu, and improve our visual experience a lot. For that, we are going to use different MudBlazor components like AppBar, Drawer, Icons, NavMenu, Links, etc.
Blazor Material UI - Configuration and Theme Customization
In this article, we are going to learn how to integrate MudBlazor inside the Blazor WebAssembly application, and thus create a Material UI Blazor project. We are not going to learn about Blazor WebAssembly itself. If you are not familiar with Blazor WebAssembly, we strongly recommend reading our Blazor WebAssembly series of articles. There, you can learn everything you need to develop great Blazor WebAssembly applications. In this article, and in all the articles from the Blazor Material UI series, we will try to convert the project created in our Blazor WebAssembly series to a material one by using material components from MudBlazor. Additionally, in this one, we are going to learn how to use themes to change the entire look of our application.
Using Roles in Blazor WebAssembly Hosted Applications
In this article, we are going to learn how to use Roles in Blazor WebAssembly Hosted applications for an additional level of security for both Blazor-Client pages and Blazor-Server controllers.
Polly and Blazor, Part 2 – Using the Context
This post is a short follow up on the one where I used Polly Wait and Retry in Blazor. In that previous post I used variables defined in my C# method to pass information back to the calling code, to display on the screen. But here I’m going to show how the Polly Context could be used instead.
Persisting your users preferences using Blazor and Local Storage
In the last post we saw how you can use TailwindCSS with Blazor to toggle “dark mode” on and off in your web applications. But it’s a pain for your users to have to do this every time. It would be much nicer if this setting was persisted in some way. That way, they’d get the same “mode” each and every time they visit your site.
Create new component in Blazor
In one of my previous blog posts I discussed my preferred way of organizing my Blazor projects. This included filenames, folder structures, code being separated from view etc. Implementing this sometimes takes time and is prone to mistake, so I created a small tool to help me do this.
Blazor, Updating or Refreshing the Display During a Method Call
This is a quick post to show how to show how to refresh or update components on a Blazor page asynchronously, for example in response to a task or tasks completing. In this example I have a button that calls a method, inside the method I have for loop, inside each iteration of the for loop, I increment the counter twice, delay twice, and update the display twice using a call to StateHasChanged().
Developer Decries WinForms-to-Blazor Performance Degradation
Since shipping .NET 5, Visual Studio 2019 v16.8 and more goodies recently, Microsoft has been touting speed improvements in many components -- including the red-hot Blazor project -- but some real-world developers are finding different results. Blazor, of course, is the quickly evolving framework for creating web projects with C# instead of JavaScript. Blazor itself has two components for server-side and client-side coding: Blazor Server and Blazor WebAssembly. The latter uses revolutionary -- and still young -- WebAssembly technology (or WASM) to allow for the use of C#, acting as a compilation target.
Complex Model Validation in Blazor Applications
In our Forms and Form Validation in Blazor article, we have learned how to validate a form using a non-complex model. But what about a complex model validation, is it the same process? Well, in this article, we are going to answer that question. We will learn how to implement complex model validation in Blazor and also how to apply a compare validation. Both of these validation processes require a bit different logic comparing to what we learned in the mentioned article.
Blazor JavaScript Isolation, Modules, and Dynamic C#
This post will describe enhancing the existing Blazor API using extension methods to make importing JavaScript modules clearer. We’ll create a new type that will allow us to write C# code that looks similar to its JavaScript counterparts.
Custom Validation in Blazor WebAssembly
In our Blazor WebAssembly series, we’ve already talked about Forms and Form Validation. There we learned a lot about creating and validating forms but there is still more to it. In this article, we are going to extend that topic by introducing a custom validation in Blazor WebAssembly. We are going to learn how to add custom validation attributes and use them for our model objects. Also, we are going to see how to customize our error messages and how to customize the style of the input elements on the form.
再聊 Blazor,它是否值得你花时间学习
之前写了一篇文章《快速了解 ASP.NET Core Blazor》,大家关心最多的问题是,我该不该花时间去学习 Blazor。今天聊聊这个话题,并表达一下我个人的看法。在此之前,我还是想不厌其烦的介绍一个 Blazor。
Blazor WebAssembly Component Virtualization with ASP.NET Core API
In this article, we are going to talk about Blazor WebAssembly component virtualization and explain how to use the Virtualize component to achieve that. Also, we are going to show you how to achieve the Blazor WebAssembly component virtualization while fetching the data from the web API project.
Is it possible to render components "dynamically" using Blazor?
Nothing twists a developer’s brain more than things being ‘dynamic’ (except perhaps, recursion). It’s all very nice and predictable when you can look at the code and see exactly which components are being rendered on any given page.
Global HTTP Error Handling in Blazor WebAssembly
In this article, we are going to learn about handling HTTP errors in the Blazor WebAssembly application. We are going to start with a simple example, and then improve the solution until we implement global HTTP error handling with the Blazor WebAssembly interceptor. With this, we are going to create...
Lazy Loading in Blazor WebAssembly
In this article, we are going to learn how to implement Lazy Loading in Blazor WebAssembly. Lazy Loading enables us to improve the startup speed of our Blazor WebAssemblyapplication by delaying the download of the resources we do not require yet. For example, if we have a large Blazor WebAssemblyapp...
Wrapping JavaScript Libraries with C# in Blazor WebAssembly
Up until now, in this series of articles, we have learned how to call JavaScript code from C#, how to call C# code from JavaScript, and also how to extract a JS code and use it from the Razor class library. But all the time, we had to write some JavaScript code to make the functionality works. That said, in this article, we are going to learn more about wrapping JavaScript Libraries with C# so that our library users can consume JS libraries by writing only C# code.
How to Use Browser Functionalities with Blazor WebAssembly
There are a lot of browser functionalities that we can use in our Blazor WebAssembly application like local storage, session storage, offline/online status, etc. These can be quite useful, so in this article, we are going to learn how to use browser functionalities with Blazor WebAssembly. We are going to learn how to check if our application is currently online or offline and also, how to use a separate razor class library to extract our JavaScript Interop code.
How to Call C# Methods from JavaScript in Blazor WebAssembly
In the previous two articles of this series, we have learned how to call JavaScript functions from C#. Now, as a logical continuation, we are going to learn how to call C# methods from JavaScript in our Blazor WebAssembly application.