Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO.Net and MM BO's
Message
 
To
05/03/2004 17:16:34
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00883709
Message ID:
00883821
Views:
8
Kendall,

>How can I load the new empty row using this.otblclass.loadrow() Or do I need to do that at all?

You don't need to do this at all. If you look at the source code in mmBusinessObject.NewRow(), you'll see it already stores the new DataRow in the business object's DataRow property:
this.DataRow = dr;
When you call the NewRow method, it adds a new row to the business object's DataSet/DataTable. The new DataRow is surfaced in the business object's DataRow property, but internally, it belongs to the business object's DataSet/DataTable.

Regarding saving the data in your btnSave_Click() method, check out the MM .NET Dev Guide Help topic "Integrating Business Objects with a Web Form". At the bottom of this topic is a section "Saving Data Using Business Objects". It contains the following sample code that describes what's happening as you perform each step:
private void btnSave_Click(object sender, System.EventArgs e)
{
	//  Retrieve the original DataSet from the Session variable
	DataSet dsOrder = (DataSet)Session["dsOrder"];

	// Call the Web Form's Save method, passing the business object and the original data.
	// The business object raises a Saving event and all bound Web controls
	// bind their data back into the DataSet
	if (this.Save(this.oOrder, dsOrder, this.oOrder.TableName) ==
		mmSaveDataResult.RulesPassed)
	{
		Response.Redirect("CustomerOrders.aspx");
	}
}
Notice that you first retrieve the original DataSet from a session variable. Afterwards, you pass it to the business object's Save() method (second parameter). Before the business object saves the data, it raises a Saving event. User interface controls that are registered as listeners of the business object (based on what you've entered in the UI controls' binding properties at design time), respond to the Saving event by automatically storing there values back into the business object's DataSet/DataTable.
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