Mark,
> Here's my code that adds the new row: This doesn't generate an error, but the new row doesn't get the OrderID value I passed.
> private void btnNew_Click(object sender, System.EventArgs e)
> {
> // Retrieve the previous Order Detail DataSet
> DataSet dsOrderDetail = (DataSet)Session["dsOrderDetail"];
> // Add a new row to the DataSet
> this.oOrderDetail.NewRow(dsOrderDetail, this.oOrderDetail.TableName,
> new OrderDetailDefaultValues(this.OrderID));
> // Store the DataSet back into the session
> Session["dsOrderDetail"] = dsOrderDetail;
> // Set the new row for editing
> this.grdOrderDetail.EditItemIndex = dsOrderDetail.Tables[oOrderDetail.TableName].Rows.Count-1;
> // Rebind the DataGrid
> this.BindControl(this.grdOrderDetail);
> }
Right...I've changed the code in the Dev Guide as you listed above. You need one additional step for the default values to work properly. I'm not sure if this step is your current version of the Dev Guide Jump Start, but you need to put the following code in the OrderDetail business object's Hook
protected override void HookSetDefaultValues(DataRow dataRow)
{
if (this.DefaultValues != null)
{
OrderDetailDefaultValues Defaults = (OrderDetailDefaultValues)this.DefaultValues;
dataRow["OrderID"] = Defaults.OrderID;
}
}
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