TemplateControlCanDelete Property

This read-only property can be overridden to let a derived template allow or deny a request to delete a row.

Definition

Namespace: EWSoftware.ListControls
Assembly: EWSoftware.ListControls (in EWSoftware.ListControls.dll) Version: 2023.4.9.0
public virtual bool CanDelete { get; }

Property Value

Boolean
Returns true to allow the delete, false to prevent it. If not overridden, it always returns true.

Remarks

The row being deleted is always given the first chance to deny the deletion. If the row allows it, the data list raises its DeletingRow event to let the containing form have a chance to permit or deny the deletion.

There are advantages to putting delete confirmations within the template. It has direct access to its controls so it is easier to perform any necessary validation prior to allowing the deletion. If the template is used in many forms, it also saves you from having to add an event handler for the data list's DeletingRow event in each one too.

See Also