Normal 0 false false false EN-US X-NONE X-NONE
Hello Sir, I am presently using NetAdvantage for .NET 2007 Vol. 3 CLR 2.0 in my windows application. I am using a UltraWinGrid which is bound to collection of class exposing certain public properties(which are displayed as the columns). One of the columns in the grid whenever hovered over/or clicked on it displays a dropdown which is a bound to a valuelist. It is assumed that whenever there is a selection in the dropdown, the value is assigned to the grid's cell. But in our case, the property that is shown as the column is the class's property, so grid displays changed value when the underlying class's property itself has the changed value. Whenever there is a selection in the dropdownlist, we are handling the CellUpdate event of the grid to run certain business logic, and eventually updating the value in the dropdown column as well. Initially we had an issue identical to the current issue. When user activates the dropdown column by clicking on it and scrolls on the grid, the dropdown cell's Value and Text properties were not in sync and because of which there was this is ditto exception. This was very specific and reproducible when the Cell's Value to start with was null/string.Empty. To resolve the same, we had to handle Grid_MouseWheel event wherein a check was made to determine if the dropdown cell's Text value is String.Empty but the Value property is not null, then we intentionally were setting the Value property to Null. So the issue was resolved. Considering the window which has this grid with another window within the application. When the user has activated the dropdown cell and moves on to the other window to do someother task and in the meanwhile scrolls the mouse, then an exception is thrown once in a while. The behaviour is very unpredictable. Probably the exception itself should provide some clarification needed. I am posting the exception as it is here. Please help me with the same. Exception Details: ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.EditorWithCombo.Infragistics.Win.IValueListOwner.OnSele ctionChangeCommitted() at Infragistics.Win.ValueList.ProcessSelectionChangeCommitted() at Infragistics.Win.ValueListDropDown.OnSelectionChangeCommitted() at Infragistics.Win.ValueListDropDown.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at Infragistics.Win.ValueListDropDownUnsafe.WndProc(Message& message) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Thank you, Murali
Hi Murali,
I'm afraid you lost me in you pretty early on in your description.
tsms said:But in our case, the property that is shown as the column is the class's property, so grid displays changed value when the underlying class's property itself has the changed value.
I don't understand what this means or how it is different than any other column grid.
Hi Mike,
"But in our case, the property that is shown as the column is the class's property, so grid displays changed value when the underlying class's property itself has the changed value."
It means that, instead of binding the datatable to the grid, I am binding a collection of class. So if the grid has to show the updated the value when updated, then the underlying class(for that updated row) should have the updated the value. Am I making sense??
Thanks,
Mike
I am still not sure I understand your question.
If you bind the grid to a list or BindingList of custom objects, then each item in the list becomes a row in the grid and each property of the objects is a column. This is really no difference than binding to a DataTable where the rows in the table are rows in the grid and the columns in the table are columns in the Grid. In fact, all of this is done via the BindingManager and the IBindingList interface. The grid doesn't know the difference, nor does it care.
If you edit a cell in the grid, the underlying object in the collection will be updated.
It sounds like maybe you are talking about changing a value of the object in the underlying collection. When that happens, it is the responsibility of the data source to notify the BindingManager that a change occurred. If you are using a collection and your collection implements IList, but not IBindingList, then there will be no notification - IList is not a robust enough interface and is really not intended for this kind of binding, so it has no notifications for when values change.
To get this to work with a custom class of your own, you should use an IBindingList, like BindingList<T>. You probably also have to implement INotifyPropertyChanged on your custom class.