The properties for my UltraGrid show a property for what appears to be each of the ErrorProviders defined on the form. The description column is like "Error on ErrorProvider1" where ErrorProvider1 is replaced with the name of the provider. The property value is blank and when you click on it there are no defaults, dropdown or elipses provided. Is is possible to link the grid to an ErrorProvider and if so how?
Thanks, Dave
Hi Dave,
There is no such property on the grid. You are probably looking at an extender property. If you place an ErrorProvider component on your form, then the ErrorProvider component provides an extender property to any controls on the form. It's nothing to do specifically with the grid, this will show up on any control.
So then there isn't any way to use an ErrorProvider with an UltraGrid?
Hi,
Well, it depends on what you mean. An ErrorProvider component is intended to provide errors to a control. In this respect, the grid is no different than any other control.
I suspect, however, that you probably want to use the ErrorProvider to provide errors on the cell or row level, rather than to the whole grid. In that case, the answer is no, you can't use an ErrorProvider for this.
The grid does support the IDataErrorInfo interface, though. So you could display errors in the grid in a way very similar to the error provider, if you are using a data source that supports this interface, like a DataTable or DataSet. You just have to set UseDataErrorInfo to true. This property is on the Override object in the grid, I think.
I have implemented a grid whose data source is a business object, ie List<Customer>. This Customer class inherits from IDataErrorInfo. Everything works great, I can see the error icons in the individual cells.
My problem is I'm only validating at save time and I have lots of rows and bands. If there are many errors, it's difficult to visually find all the errors. I'd like to add a button that allows the user to go the next and previous error. Is there a programmatic way of going from one error to the next and putting the focus on the cell in error?
Hello,I am facing a very similar situation, which you faced some time ago.I have a grid whose data source is a business entity, ie BidingList<Person>. I want to validate user inputs for all cells in the row(s) for that grid.I want to use the approach listed at http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WinGrid_Display_Row_Cell_Errors_Using_IDataErrorInfo.html but the issue is that in my case the e.Row.ListObject returns a BidingList<Person>. , whereas the example in this link expects a DataRowView .How did you resolve it in ur case, as you also had a business entity and not a DataRowView .Pls advice.Is there any other better approach for it ? using fragistics UltraValidator control, custom coding for cellupdate events, etc.
If the grid data source is bound to a business entity, ie BindingList<Person>, then wouldn't e.Row.ListObject simply return an entity instance of Person?
My problem exactly, sample code fails on following line:
var drv = (DataRowView)e.Row.ListObject;
Have you solved this? And how?
Hi Tobias,
The ListObject returns the object in the data source that represents the data item. The problem with the code you have here is that it is assuming that the object is always a DataRowView. That will only be true if you are using a DataSet / DataTable as your DataSource. If you are using a List<T> or a BindingList<T>, then you can't cast that into a DataRowView, because it's not a DataRowView, it's a T.
So if your data source is: BindingList<Person>
Then your code to get the typed ListObject would be:
var drv = (Person)e.Row.ListObject;