Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Blazor Web Development Cookbook
  • Table Of Contents Toc
Blazor Web Development Cookbook

Blazor Web Development Cookbook

By : Pawel Bazyluk
close
close
Blazor Web Development Cookbook

Blazor Web Development Cookbook

By: Pawel Bazyluk

Overview of this book

With support for both server-side and client-side hosting, as well as the flexibility to mix render modes, Blazor empowers you to leverage cloud computing while maintaining the performance of local applications. Paweł Bazyluk—a Blazor expert with over a decade of experience in .NET technologies—shows you how Blazor, a Microsoft framework, enables you to create interactive web applications using C# and .NET, while reducing reliance on JavaScript. This cookbook highlights Blazor’s vast possibilities using practical recipes that address key aspects of web development and showcase the framework's versatility in building modern, integrated applications. Pawel demonstrates how to skillfully navigate component-based architecture, and create, parameterize, and customize components to achieve high modularity. Working through practical insights and hands-on guidance in each chapter, you’ll progress from advanced data binding and event handling intricacies to optimizing data display using grids. You’ll explore application state management, build interactive forms with validation, leverage Blazor’s routing engine, and keep every part of the application secure. The book also explores cutting-edge topics, touching on how to enhance your application with AI-powered features. By the end of the book, you’ll be fully equipped to build robust, scalable, and secure web applications in Blazor.
Table of Contents (13 chapters)
close
close

Validating complex data models

In this recipe, we tackle the validation of complex forms and data models. Having well-structured and modularized code makes the code base easier to maintain and reduces the likelihood of errors by clearly defining and isolating each component’s responsibilities. In forms, complex models segment the data into manageable parts, each with its validation logic, making it easier to maintain the overall form’s state and ensuring each segment adheres to specific business rules. The Microsoft.AspNetCore.Components.DataAnnotations.Validation package, although experimental, exposes Blazor-native validators and offers enhanced data annotations that integrate smoothly with complex models.

Let’s extend the event creation form to include a nested object that encapsulates details about the event location.

Getting ready

Before we set up nested, complex model validation, do the following:

  • Create a Chapter07/Recipe04 directory –...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Blazor Web Development Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon