Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MmDataGridView error icon
Message
 
To
06/02/2007 12:54:58
Alan Hoiland
Canadian Natural Resources Ltd.
Calgary, Alberta, Canada
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01192905
Message ID:
01193098
Views:
14
Alan,

>We have data displayed in a MmDataGridView. The user will update several rows and then push a save button. We can loop through the dataset, set an entity to each row, and fire the rules for each entity.
>
>However, if a rule fails, the error icon always shows up next to the currently selected cell. How do we set the icon to the cell in error?

In your business rule's CheckRulesHook() method do you have code that sets the CurrentRow property? This tells the Windows Forms error provider which row the error belongs to. For example:
public override bool CheckRulesHook(DataSet ds, string tableName)
{
	if (ds.Tables[tableName].Rows.Count > 0)
	{
		this.CurrentRow = 0;
		foreach (DataRow Row in ds.Tables[tableName].Rows)
		{
			if (Row.RowState != DataRowState.Unchanged && Row.RowState != DataRowState.Deleted)
			{
				OrderDetailEntity Entity = new OrderDetailEntity();
				Entity.SetDataRow(Row);

				// Call validation methods
				this.ValidateDiscount(Entity.Discount);
				this.ValidateOrderID(Entity.OrderID);
				this.ValidateProductID(Entity.ProductID);
				this.ValidateQuantity(Entity.Quantity);
				this.ValidateUnitPrice(Entity.UnitPrice);
			}
			this.CurrentRow++;
		}

	}

	// 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