|
C#
public static bool BeforeDelete(System.Web.UI.Page Page,
IDictionary e)
{
string orderID = (string)e["key"];
// orderID - id pointing to record to
be deleted.
if (!string.IsNullOrEmpty(orderID))
{
Order_DetailsCollection details = new
Order_DetailsCollection();
Query qry = new Query(Order_Details.Schema).WHERE("OrderID", orderID);
details.LoadAndCloseReader(qry.ExecuteReader());
//Check if specific record
exists
if (details.Count > 0)
{
//if record exists tell about
it
Page.Response.Write("You can't
delete this record. Try to delete all order details for this order
before");
return false;
}
return true;
}
//return true if you like to proceed
with deleting record
//return false in other case
return false;
} // BeforeDelete
|