Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datagridview validation
Message
 
To
05/09/2006 09:45:55
Jeff Corder
Ambit Technologies, LLC
Missouri, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01150920
Message ID:
01151193
Views:
34
Jeff,

>I ran the program, selected Customer ANATR and Invoice 10308. When I went to the Properties page, I changed the Qty in the first line to 6 and hit Save. It gave me an error that the discount could not be 0 (IsEmpty() issues are another story). I changed it to 1 and it saved fine. I moved to the second line, changed the Qty to 6 and hit save, and did not get an error for the Discount being 0. I got curious. I set a breakpoint in OrderDetailRules.CheckRulesHook to see what is happening. It turns out that this.CurrentRow stays at 0. So when I enter data in row 1, it validates row 0 again. I sure hope I'm missing something here. I realize that the demo does not contain bulletproof validation, but this has me concerned.
>
>I look forward to you pointing out the error of my ways,

The code in the OrderDetail business object demonstrates how to check rules on a single DataRow. To check rules on all rows, you just need to loop through each DataRow in the CheckRulesHook() method. For example:
public override bool CheckRulesHook(DataSet ds, string tableName)
{
	if (ds.Tables[tableName].Rows.Count > 0)
	{
		foreach (DataRow Row in ds.Tables[tableName].Rows)
		{
			OrdersEntity Entity = new OrdersEntity();
			Entity.SetDataRow(Row);

			// Call validation methods
			this.ValidateCustomerID(Entity.CustomerID);
			this.ValidateShipName(Entity.ShipName);
		}
	}

	// Change this return value to indicate result of rule checking
	return this.ErrorProviderBrokenRuleCount == 0;
}
Best 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