Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO.Net and MM BO's
Message
From
08/03/2004 12:27:02
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00883709
Message ID:
00884141
Views:
13
Kevin,

Thanks for responding. I still need some help with the Page_Load code though. My dropdown's will throw an exception (invalid index)if I don't load a row similar to this;
this.otblClass.LoadRow(0);
I did look at the source before I sent the first message and really couldn't figure out why the dropdowns weren't working with the empty dataset/new row code I posted. That's why I thought I needed to load the row into the BO somehow. Geez, what am I missing here,<s>? I won't be able to work through the Save code until my dropdown issue is addressed because the FK fields do not allow nulls on Insert (yea, I could plug in some text fields and put in a key value, but that won't solve my problem) I need to understand this dropdown issue first.

My Page_Load code;
{
	// tblClass BO
	this.otblClass = (tblClass)this.RegisterBizObj(new tblClass());

	// get an empty dataset
        DataSet DS = this.otblClass.GetEmptyDataSet("tblClass");
	this.otblClass.SetCurrentDataSet(DS);

	//add a new row
	 this.Class.NewRow("tblClass");

	//this.otblClass.LoadRow(0);  // don't understand this, can't run without this line, combo breaks ???
	
        // save the dataset to Session
        Session["tblClass"] = this.otblClass.GetCurrentDataSet();

etc...
Thanks!

>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.
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform