OnDataBinding

From AutoCount Resource Center

Go to menu

Go to top
Resources For AutoCount Software Developers



OnDataBinding

OnDataBinding is triggered when a form's data is loading after form components have been created.
OnDataBinding is triggered everytime when the form is opened.


Usage

  • Load updated data when the form's data has been reset after form is reopen.
  • Add Data Binding to control or editor
  • Remove/Add events to a control


OnDataBinding event in Sales Invoice

public void OnDataBinding(BCE.AutoCount.Invoicing.Sales.Invoice.FormInvoiceEntry.FormDataBindingEventArgs e)

Example

Add a TextEdit box on Header Panel and add Databinding to Document's Description

Add using Directive

using BCE.Data;
using DevExpress.XtraEditors;
private LabelControl lblDesc = new LabelControl();
private TextEdit txtEdtDesc = new TextEdit();

public void OnFormInitialize(BCE.AutoCount.Invoicing.Sales.Invoice.FormInvoiceEntry.FormInitializeEventArgs e)
{
    lblDesc.Location = new System.Drawing.Point(10, 255);
    txtEdtDesc.Location = new System.Drawing.Point(125, 250);
    lblDesc.Text = "Description";
    txtEdtDesc.Size = new System.Drawing.Size(600, txtEdtDesc.Size.Height);

    e.HeaderPanel.Controls.Add(lblDesc);
    e.HeaderPanel.Controls.Add(txtEdtDesc);
}

public void OnDataBinding(BCE.AutoCount.Invoicing.Sales.Invoice.FormInvoiceEntry.FormDataBindingEventArgs e)
{
    txtEdtDesc.DataBindings.Clear();
    txtEdtDesc.DataBindings.Add("Text", e.MasterTable, "Description");
}

TextEdit box of System's Description is in More Header tab. Instead of moving the system control from More Header tab to Header Panel, create new TextEdit box and add data binding to description.
Clear the control's data binding before adding data binding.


See Also