Data Binding MM .NET Web Forms Controls
Common Binding Properties
Most MM .NET Web Forms controls have the following common binding properties that allow you to easily bind to them without writing any code:- BindingType
- BindingProperty
- BindingSource
- BindingSourceMember
Note: If you do not want to use these custom MM .NET properties, you can still use standard Web Forms data binding by using the built-in .NET data binding properties.
The BindingProperty Property
BindingProperty allows you to specify the property of the user interface control that is bound to data. By default, this is set to Text for most Web controls.The BindingSource Property
The BindingSource property specifies the business object that is the data source for the user interface control. You can manually enter the business object class name, or use the Binding Source Selection dialog. When you select the BindingSource property in the Properties Window, a small command button (...) appears to the right of the property:
If you click this button, the Binding Source Selection dialog appears:
This dialog displays a list of business objects that have been registered with your form (for details on registering business objects, see the section Integrating Business Objects with a Web Form). You can select a business object from this dialog by double-clicking a selection in the list box, or by selecting a business object and clicking the OK button.
Tip: You can set the BindingSource property of multiple user interface controls simultaneously by selecting the user interface controls in the IDE, then launching the Binding Source Dialog.
The BindingSourceMember Property
The BindingSourceMember property specifies the data source member (usually a column in a DataTable or DataView) the user interface control is bound to. You can manually enter a BindingSourceMember value in the Properties Window, or use the Binding Source Member Selection dialog. In the Properties Window, when you select a control's BindingSourceMember property, a small command button (...) appears to the right of the property:
If you click this button, the Binding Source Member Selection dialog appears:
This dialog is data driven from your application's configuration file (web.config). For more information, see the Help topic Database Settings in the Application Configuration File.
Database Sets
If you have database sets specified in your application configuration file, these are listed in a Database Sets combo box in the upper left corner of the dialog. When you select a database set, the Databases combobox, Tables list box and Fields list box are updated accordingly. If you do not have database sets specified in the config file, this combo box does not appear at all.Databases
The Databases combo box contains a list of all databases for the currently selected database set. If you don't have any database sets, this combo box contains a list of all databases listed in the config file. When you select a database from this combo box, the Tables list box and Fields list box are updated accordingly.Tables
The Tables list box contains a list of all tables for the currently selected database. If you select a table from this list box, the Fields list box is updated accordingly.Fields
The Fields list box contains a list of all fields for the currently selected table.Include Table Name
If this checkbox is selected, when you click the OK button, both the table name and the field name are placed in the BindingSourceMember property. If this checkbox isn't selected, only the field name is placed in the BindingSourceMember property.
Note: Do not select this checkbox unless the selected table name is the same as the default TableName property specified in the business object, or some other table name within a DataSet of the business object!
Typically, you can leave this checkbox unselected if the user interface control is bound to the business object's default DataTable.
The BindingType Property
The BindingType property allows you to specify the type of binding to be applied to the control. As shown in the image below, you can select three possible settings from the Visual Studio Property Window:
- None - If you don't want a control bound to data at all, set its BindingType property to None at design time. If you want to temporarily turn off data binding for a particular control, you can set its BindingType property to None at runtime.
- OneWay - Specifies that data binding only occurs for the control when the associated business object retrieves data.
- TwoWay - Specifies that data binding occurs when the associated business object retrieves data, AND the values in the control are persisted when the business object saves data.
Note: When you drag and drop a Web Control on a form, Visual Studio automatically changes the value of this setting to TwoWay! You can set it back to the default value (OneWay for most controls) by right-clicking the BindingType property in the Property Window and selecting Reset from the shortcut menu.
Binding to DataViews
If you are binding to DataViews rather than DataTables, you can use this dialog to quickly specify the DataTable and data column you want to bind to, then afterwards go back to the Properties Window and manually prefix the name of the column with the name of the DataView (for example, Orders.dvOrders.OrderID).Binding to Alternate Data Sources
At times, rather than binding Web controls to DataSets loaded by business objects, you may want to bind to alternate data sources such as business object properties, form properties, DataRows, and so on. For details on how to do this, see the Help topic Data Binding Web Controls to Alternate Data Sources.Binding with Read Only Controls
A user interface control may be read-only if:- It's specified read-only at design time
- It's set to read-only programmatically at run time by application-level code
- It's set to read-only programmatically at run time by Framework-level security code
If a control is read-only, its value is not bound back even if its BindingType property is set to TwoWay. This prevents malicious end users from hacking a web page's source code and bypassing application security.
See Also
Data Binding Simple Bound Controls | Data Binding List Controls | Data Binding Data Grids | Specifying Connection Strings and Database Settings
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 02/12/26
Comment or report problem with topic
