Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AddRequiredField Error provider
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00936642
Message ID:
00955632
Views:
28
Nick,

>I checked the code you proposed and I found it is exactly the same code as in the mmBusinessRule object. So, I dont see how it will fix the problem if it does not fix the problem /if you know what I mean <s>/.

Actually, it is a bit different. The following code:
return this.CheckRequiredFieldsInRow(ds, tableName, this.DataRow, 0, useErrorProvider);
was changed to:
return this.CheckRequiredFieldsInRow(ds, tableName, this.DataRow, this.CurrentRow, useErrorProvider);
Note that previously the error row was hard-coded to zero. In the updated code, this.CurrentRow is used instead.

In order to take advantage of this, you need to make sure your business rule code sets the CurrentRow property when looping through records. For example:
public override bool CheckRulesHook(DataSet ds, string tableName)
{
	bool result = true;
	int RowCount = ds.Tables[tableName].Rows.Count;
	for (int row=0; row<RowCount; row++)
	{
		this.DataRow = ds.Tables[tableName].Rows[row];
		this.CurrentRow = row;

		if (this.DataRow["Quantity"] is Int16)
		{
			this.ValidateQuantity((System.Int16)this.DataRow["Quantity"]);
		}
		else
		{
			this.ValidateQuantity((int)this.DataRow["Quantity"]);
		}
		this.ValidateProductID((int)this.DataRow["ProductID"]);
	}
	return result;
}
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
Reply
Map
View

Click here to load this message in the networking platform