My application uses Tag property to store the data (with customize type) in each row. Every time the form (that contains the UltraGrid) is loaded, it creates UltraDataSource that each its UltraDataRow has Tag property assigned with. If the property is not filled with the data the grid would show nothing (there's no row in the grid).
In other words, UltraDataRow.Tag property has to be filled with the data.
Foo foo = GetDataFooFromSomewhere();
object[] cellValues = GetCellValuesFromFoo(foo);
UltraDataSource dataSource = new UltraDataSource();
UltraDataRow row = dataSource.Rows.Add(cellValues);
row.Tag = foo;
UltraGrid grid = new UltraGrid();
grid.DataSource = dataSource();
And whenever users change the value in the grid, in AfterCellUpdate(), foo instance is extracted from UltraGridRow and is updated. So filling the Tag property is crucial.
Problem arise when excecuting UltraDataSource.LoadFromXml(). The loaded UltraDataRow.Tag property simply is null. But when i see the xml file, there's Tag xml tag:
<!-- other xml data -->
<a2:UltraDataRow id="ref-9" xmlns:a2="http://schemas.microsoft.com/clr/nsassem/Infragistics.Win.UltraWinDataSource/Infragistics2.Win.UltraWinDataSource.v8.3">
<!-- the Tag is saved in this xml file but cannot be loaded again -->
<Tag xsi:type="a3:ObjectWrapper" xmlns:a3="http://schemas.microsoft.com/clr/nsassem/Infragistics.Shared.Serialization/Infragistics2.Shared.v8.3">
<objectValue href="#ref-18"/>
</Tag>
</a2:UltraDataRow>
My guess is that your Foo object is not Serializable.
If it isnt Serializable, it would not even be saved to xml file. The Tag xml tag would not be exist.
Beside i wonder, why dont the LoadFromXML method didnt fire grid events? Such as InitializeRow, AfterCellUpdate etc. It modified grid but didn't fire any event.
Thank you very much for your reply.
And sorry about LoadAsXML didnt fire any grid events. The method indeed fires InitializeRow event.
Here is the FooApplication regarding the problem. I use online file storage, i dont know why I cant upload to this forum. Maybe my office bloked it.
Hi,
I took a brief look and I can't see anything wrong with your code here. In fact, if I put a breakpoint in the deserialization constructor of the Foo object, it actually gets hit when you call LoadFromXML. So the object is getting created and it's somehow not getting assign to the Tag of the DataRow during deserialization. So this looks like a bug in the UltraDataSource to me.
I'm going to forward your post over to Infragistics Developer Support so they can write this up and get it looked it by the development team.
Has this bug been resolved? I am still facing the same problem. My rows have a string tag which is not getting deserialized.
This was fixed back in 2009.
You are right; tags are getting serialized and deserialized properly in UltraDataRow. I was incorrectly checking UltraGridRows's tags.