Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete with Business Object from a Web Form
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00852521
Message ID:
00855938
Vues:
14
Carter,

I took a look at the code in your page, and the problem is that you need to set the DataSet as the business object's "current" DataSet before you delete.

Here's the code:
DataSet dstEvents = (DataSet)Session["dstEvents"];
this.otEvents.SetCurrentDataSet(dstEvents);
this.otEvents.Delete();
Response.Redirect(this.sListPage);
Previously, when you were calling the Delete method, passing the DataSet in, the DataSet does not automatically get set as the business object's current DataSet (by design). So when you the UI controls try to bind to the business object, you get an error because the business object has no data.

The same is true of your Save button event handler:
DataSet dstEvents = (DataSet)Session["dstEvents"];
this.otEvents.SetCurrentDataSet(dstEvents);
this.otEvents.NewRow();
OakLeaf.MM.Main.Business.mmSaveDataResult result = this.otEvents.SaveDataSet(dstEvents);
if (result == OakLeaf.MM.Main.Business.mmSaveDataResult.RulesPassed)
{
	Response.Redirect(this.sListPage);
}
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform