Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete with Business Object from a Web Form
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00852521
Message ID:
00855938
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform