AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

ToolControlBase..::..LoadDataFromObject Method

Override to populate form fields from the business object properties.

Namespace:  AdvantageCMS.Core.Admin.BaseClasses
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


protected void LoadDataFromObject(
	ActionArgs e
)

Parameters

e
Type: AdvantageCMS.Core.Admin.Event..::..ActionArgs
The action arguments providing context (user, SQL, domain, language).

Examples


Read each property from MyObject and assign it to the corresponding form control. Use Items.FirstOrDefault (not FindItemByValue) for dropdown lookups.
C#
protected override void LoadDataFromObject(ActionArgs e)
{
    txtName.Text = MyObject.Name;
    txtDescription.Text = MyObject.Description;
    txtPrice.Value = (double?)MyObject.Price;
    chkIsActive.Checked = MyObject.IsActive;
    var item = ddlCategory.Items.FirstOrDefault(i => i.Value == MyObject.CategoryId);
    if (item != null) ddlCategory.SelectedIndex = ddlCategory.Items.IndexOf(item);
}