TemplateControlChangePolicyModified Method

This can be overridden to handle modifications in the change policy in the parent DataList control.

Definition

Namespace: EWSoftware.ListControls
Assembly: EWSoftware.ListControls (in EWSoftware.ListControls.dll) Version: 2023.4.9.0
protected virtual void ChangePolicyModified()

Remarks

The base class implementation does nothing. You can override this in derived template controls so that they can handle modifications in the change policy such as disabling editable controls when edits are disabled, etc. Overriding this method saves you from hooking up an event handler in the template. This method is only called on controls that have been initialized and bound when the change policy is modified in the parent DataList control.

Example

C#
// Enable or disable the controls based on the edit policy.
protected override void ChangePolicyModified()
{
    if(this.TemplateParent.AllowEdits != txtFName.Enabled && !this.IsNewRow)
       txtFName.Enabled = txtLName.Enabled = txtAddress.Enabled =
         txtCity.Enabled = cboState.Enabled = txtZip.Enabled =
           this.TemplateParent.AllowEdits;
}

See Also