Click or drag to resize

MapperExtensionKernelMapperCommand Method

Fired when a mapper command has been invoked. MapperCommands can be added to a mapper programmatically by adding a MapperCommand(IMapper, EAPCommandEventArgs) to Commands, typically during the MapperBeforeLayout(IMapper, EAPEventArgs) event. They can also be specified in meta-data via a NavTarget with TargetType of Command on a menu Navigator.

Namespace:  NetQuarry.Data
Assembly:  EAP.Mapper (in EAP.Mapper.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public virtual void MapperCommand(
	IMapper sender,
	EAPCommandEventArgs e
)

Parameters

sender
Type: NetQuarry.DataIMapper
The event's sender.
e
Type: NetQuarryEAPCommandEventArgs
Event arguments.
Examples
The following FieldButtonClick handler demonstrates how to return an error from an event and execute a SQL statement to update a table.
public override void FieldButtonClick(IField sender, EAPEventArgs e)
{
    if (sender.Key == "btn_enable")
    {
        IField fldID = sender.Fields["dealer_id"];
        IField fldDealershipID = sender.Fields["dealership_id"];
        string dealerID = EAPUtil.ToString(fldID.Value);
        string sql = string.Format("UPDATE dealer SET status_id = 1 WHERE dealer_id = '{0}'", dealerID);

        if (0 == EAPUtil.ToString(fldDealershipID.Value).Length)
        {
            e.Error("You must select a dealership for this dealer before they can be enabled.");
            return;
        }                
        sender.Database.Execute(sql);
    }
}
See Also

Reference

MapperExtensionKernelMapperCommand(IMapper, EAPCommandEventArgs)