Class DataBindingItem

An individual binding item. A BindingItem maps a source object - a property/field or database field - to a property of a Control object.

The object is a child for the DataBinder object which acts as a master object that performs the actual binding of individual BingingItems.

Binding Items can be attached to controls and if the control implements the IDataBinder.

Note: This class inherits from Component so the designer can properly render the item as an extender control.

public class DataBindingItem : Control

Class Members



Default Constructor


Use this event to hook up special validation logic. Called after binding completes. Return false to indicate validation failed


Binds a source object and property to a control's property. For example you can bind a business object to a the text property of a text box, or a DataRow field to a text box field. You specify a binding source object (Customer.Entity or Customer.DataRow) and property or field(Company, FirstName) and bind it to the control and the property specified (Text).

public void DataBind()

public void DataBind(Control container)


Fires the Validation Event

public bool OnValidate()


Returns a the control bindingsource and binding source member

public virtual string ToString()


Unbinds control properties back into the control source.

public void Unbind()

public void Unbind(Control BindingContainerControl)


Reference to the DataBinder parent object.


An error message that gets set if there is a binding error on the control. If this value is pre-set this value is used instead of an auto-generated message


Determines how databinding and unbinding is done on the target control. One way only fires DataBind() and ignores Unbind() calls. Two-way does both. None effectively turns off binding.


Property that is bound on the target controlId


The binding source object that is the source for databinding. This is an object of some sort and can be either a real object or a DataRow/DataTable/DataSet. If a DataTable is used the first row is assumed. If a DataSet is used the first table and first row are assumed.


The property or field on the Binding Source that is bound. Example: BindingSource: Customer.Entity BindingSourceMember: Company


An instance of the object that the control is bound to Optional - can be passed instead of a BindingSource string. Using a reference is more efficient. Declarative use in the designer always uses strings, code base assignments should use instances with BindingSourceObject.


The ID of the control to that is bound.


An optional instance of the control that can be assigned. Used internally by the DataBindiner to assign the control whenever possible as the instance is more efficient and reliable than the string name.


Format Expression ( {0:c) ) applied to the binding source when it's displayed. Watch out for two way conversion issues when formatting this way. If you create expressions and you are also saving make sure the format used can be saved back.



Determines how binding and validation errors display on the control


Determines whether the content displayed is Html encoded to prevent script injection



Internal property that lets you know if there was binding error on this control after binding occurred


If set requires that the control contains a value, otherwise a validation error is thrown Useful mostly on TextBox controls only.


The value that is to be assigned to the control after unbinding.


A descriptive name for the field used for error display



Namespace: Westwind.Web.Controls
Assembly: westwind.web.webforms.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic