Definition - What does Data Binding mean?
Data binding, in the context of .NET, is the method by which controls on a user interface (UI) of a client application are configured to fetch from, or update data into, a data source, such as a database or XML document.
Prior to .NET, access to data binding models was limited to databases. Thus, many database management systems (DBM) could indirectly access the data source through their application programming interface (API) without any flexibility in controlling the data binding process. This problem is addressed in .NET by providing fine control of how the data is bound and the behavior of UI with Windows Forms and ADO.NET classes in the framework. The development of Web applications is simplified by providing data binding capability to Web pages using .NET server side Web controls.
Techopedia explains Data Binding
- Reduction in code size
- Better performance of the application
- Rapid development of data-driven applications
- Customization of default data binding process by modifying the generated code wherever necessary
- Fine control on data binding through events
- Visual feedback on validation errors by associating validation rules of data with built-in data type validation of controls in UI (for example, date value entered in date control)
The .NET framework provides simple and complex data binding options in Windows Forms to access data from databases and structures, such as arrays and collections. In the case of a simple data binding option, one control in UI is bound to one data value in a data source while in complex option. Also, one control is bound to a collection of data, such as a Datagrid control bound to a dataset representing a list of values.
Windows Presentation Framework (WPF) in .NET 4.0 implemented the concept of data binding by connecting the properties of binding target objects (WPF elements) and any data source, including Language Integrated Query (LINQ) queries, Common Language Runtime (CLR) objects, XML and other data sources. It provides data templates for controlling presentation of data.
When data binding is applied to ASP.NET pages, any server control can be bound to simple properties, collections, expressions and methods, etc. All data binding expressions must be contained within the characters <% #%>. The framework classes, like Dataset, DataReader and others are used to obtain data from the database and link to the controls in the Web page.
The limitations of data binding include the overhead caused by checking the version of controls, the Open Database Connectivity (ODBC) driver/provider installed in the user system and the distribution of a new version of controls and middleware required to use the application in the user's system.