Certain technologies and frameworks for developing web applications, such as an active server page (e.g., ASP.NET), use the notion of controls that may be dropped on a design surface to quickly develop the outlines of a web application. The controls are further customized through code written by a developer, setting of properties, etc. One class of controls is data-bound controls which are bound to a data source and allow access to a data item, such as in a database. The data item offered by the data bound control constitutes a data binding context for the controls within the data bound control to refer to when setting their properties.
Data binding may occur at the request of a page programmer or the data-bound control may initiate the data binding process. Whenever an event occurs on the data-bound control, such as paging to the next visible set of data records, data binding the control to new data refreshes the rendering of the control. Similarly, when a user requests a data manipulation operation such as updating a record, the program needs to retrieve the new data out of the text entry controls on the page, execute the necessary calls to the data store to update the record, and then execute a call to the data binding process to refresh the rendering of the control.
A data-bound control commonly offers a data item as the data binding context for the controls inside the parent (data-bound) control. If the data-bound control determines the layout of the controls displaying data, the data-bound control can populate the control properties with data and retrieve new data values from the control properties when new values are posted back to the server. However, if the data-bound control supports user-defined templates which dictate the selection and layout of the controls within the data-bound control, the data-bound control cannot easily retrieve the values of the control properties associated with a data item field. For example, a table control may receive data from a row of a database to display to the client. A textbox within the table control may set its text property to the values of a column in the data row using a data binding statement. If the text within the textbox is changed by the client to indicate updated data, the new text must be retrieved and associated with the data row field. However, if the table control does not know which textbox contains the new value, the value cannot be retrieved and associated with a data field automatically. Instead, user code is required to retrieve the new value.
Some of the limitations of template control property data binding are addressed by one-way automatic data binding. One-way automatic data binding binds the properties of controls inside a template to data from the parent control's data binding context. However, it is common for the server control to retrieve the data from the control property at a later time. For instance, controls are commonly used for updating data in addition to displaying data. A user may modify a control property value after the page renders to the client. The page programmer is required to manually write code to retrieve control property values to update data store field values. This process is laborious and prone to error. In addition, specific knowledge of the control tree within the parent control and the template is required which may result in failure if the control tree changes across page revisions.