Difference between DataBinding and Validation in ASP.Net

Last Reply 24 days ago By dharmendr

Posted 24 days ago

I want to know what is the Page_DataBind means in ASP.NET and also Validation in ASP.NET. Is it similar to Page_DataBind or not? Also what is the Validation means in ASP.NET? If they are not similar, what are the differences?

You are viewing reply posted by: dharmendr 24 days ago.
Posted 24 days ago

Hi SamMyat,

Data Binding

Every ASP.NET web form control inherits the DataBind method from its parent Control class which gives it an inherent capability to bind data to at least one of its properties. This is known as simple data binding or inline data binding.

Simple data binding involves attaching any collection (item collection) which implements the IEnumerable interface or the DataSet and DataTable classes to the DataSource property of the control.

On the other hand some controls can bind records, lists or columns of data into their structure through a DataSource control. These controls derive from the BaseDataBoundControl class. This is called declarative data binding.

The data source controls help the data-bound controls implement functionalities such as sorting, paging and editing data collections.

For more details refer below link.

https://www.tutorialspoint.com/asp.net/asp.net_data_binding.htm

Validation

Validation in ASP.Net means validate the user input data to ensure that a form field has been properly filled by the user.

ASP.Net provides the following validation controls.

  1. RequiredFieldValidator
  2. RangeValidator
  3. CompareValidator
  4. RegularExpressionValidator
  5. CustomValidator
  6. ValidationSummary

For more details refer below links.

https://asp.net-tutorials.com/validation/introduction/

https://www.c-sharpcorner.com/UploadFile/puranindia/validation-controls-in-Asp-Net/