TypedMapperExtensionTFieldButtonClick Method |
Fired when the field's button has been clicked. A button click event is supported in both the detail and datasheet
versions of the mapper.
Note that when the FieldButtonClick event is received, the mapper will already have been positioned to the record
on which the click was performed. In the case of a FieldButtonClick on a datasheet, the original list mapper is
cloned, the cloned positioned to the appropriate record, and the event fired on the clone.
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);
}
}
In general, if the handler wants to take advantage of the FieldButtonClickArgs object, it should
test the type of the e parameter before attempting to use it since that arg type is not provided in all cases.
For exampe:
FieldButtonClickArgs args = e as FieldButtonClickArgs;
if (args != null)
{
args.Message = "The message!";
}
Namespace:
NetQuarry.Data
Assembly:
EAP.Mapper (in EAP.Mapper.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax public virtual void FieldButtonClick(
IField sender,
EAPEventArgs e
)
Public Overridable Sub FieldButtonClick (
sender As IField,
e As EAPEventArgs
)
Parameters
- sender
- Type: NetQuarry.DataIField
The event's sender. - e
- Type: NetQuarryEAPEventArgs
Event arguments. Note that this may be a FieldButtonClickArgs object (currently only for AJAX button clicks).
See Also