Performs data binding against each of the defined DataBindingItems defined on the DataBinder control. This binds all BindingSources to the specified control properties.
Typically DataBind is called in the Page_Load() of the page cycle and only when the page originally loads - ie. (if !Page.IsPostPack). Subsequent page hits post back values so you typically do not want to rebind values to POST form variables on each hit.
<> Invoice.Load(id); // load data to bind
// bind only on first load or if the product is changed if (!IsPostBack || IsProductChange) DataBinder.DataBind(this);
// Manually bind this control always - it's ReadOnly and so doesn't post back DataBinder.GetDataBindingItem(txtPk).DataBind(); <>
Some controls - non-Postback, or read only controls for example - you will want to rebind explicit each time so make sure those are bound explicitly outside of the !IsPostBack block.
public bool DataBind(Control Container)
Parameters
Container
The top level container that is bound
Overloads:
See also:
Class DataBinder© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic