DataBinding for Beginners in ASP.NET
DataBinding for Beginners in ASP.NET
When building any application, whether it’s ASP.NET web apps or WinForms desktop apps you will eventually come across the need to DataBind. DataBinding is the basic process of presenting dynamic data sources within a user interface component.
DataBinding isn’t limited to just interface components, but it is probably the most common occurrence you’ll encounter. Without DataBinding your web pages would only be able to display static data, or dynamic data populated programmatically.
DataBinding can take on numerous formats, from very simple to complex. The .NET framework also provides you with many possible DataBinding properties throughout the web control library to give you a lot of control and flexibility. Take for example a Label control, you can bind its foreground and background color properties. Although not a common requirement it shows binding can be more advanced than simple text values.
In this tutorial we’ll look at several basic examples of DataBinding on different controls available in ASP.NET. We’ll explore basic page property binding for a Label control, custom class property binding for a TextBox control, collection class binding for a DropDown control, and DataTable binding for a DataGrid control.
Note: Visual Studio .NET is required for this tutorial and both VB.NET and C# code examples will be provided