Data Binding in Blazor

In this article, we will explore Data Binding in Blazor,

Data binding is an important feature of software development data binding is the way how data transfers between view and business logic In Blazor data binding divided into two types,

1) One-way data binding

2) Two-way data binding

One way data binding we are property value from business logic to view and for achieving this we need t pass property or variable name with ‘@’.

Blazor also supports two-way data binding and this is achieved using bind attribute in Blazor.

Let's check an example of data binding,

Productlist.razor

@page “/”@inherits ProductlistBase<h3>Data Binding</h3><div><span>One Way Binding Example : @oneWayExample</span><br/><input type=”text” @bind=”currentCount”/><br/><span>Current Count is: @currentCount</span></div>

ProductlistBase.cs

using EmployeeManagement.Web.Services;using Microsoft.AspNetCore.Components;using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;namespace EmployeeManagement.Web.Pages{public class ProductlistBase:ComponentBase{public string oneWayExample = “Testing One Way Data Binding”;public int currentCount = 0;}}

Thank You, See you in the next article !!

You can reach out to me here,

LinkedIn: https://www.linkedin.com/in/vaibhav-bhapkar

Email: vaibhavbhapkar.medium@gmail.com

--

--

--

Technical Speaker | Computer Engineer | Full Stack Web Developer | ML Enthusiast | * Knowledge Shared = Knowledge² *

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

In this blog, we will discuss What is Terraform Kubernetes provider, how to use it and difference…

How to set up Action Text Rich Text Editor in Rails 6

Where does PNG TVL amount come from?

Wix to Shopify: How to Perform Migration Successfully?

Wix to Shopify Migration

Cloud as DevOps Vending Machine

Interesting facts and knowledge about Excel

Making Spaceships Fly using Timeline

3 Data Structures to Pass Coding Interview

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vaibhav Bhapkar

Vaibhav Bhapkar

Technical Speaker | Computer Engineer | Full Stack Web Developer | ML Enthusiast | * Knowledge Shared = Knowledge² *

More from Medium

C# — How to Freeze Rows or Columns in Excel

C#/VB.NET: Merge Multiple Excel Workbooks or Worksheets into One

C-Sharp c# cheatsheet

Ascend to the next level with Higher Order functions