I am using an Infragistics UltraGrid in my WinForms application. Infragistics v13.1.
v13.1
I have recently added code to save grid layouts in a binary serialized format and load them back using the CopyFrom method on the DisplayLayout object.
CopyFrom
DisplayLayout
While I load one of these saved layouts, the grid is modified appropriately and data still shows correctly in the grid, but any time I ask for a ListObject on a row, it returns null. The datasource for the grid is a BindingSource whose DataSource is a BindingList (this data is not changed when the layout is loaded).
ListObject
BindingSource
DataSource
BindingList
Save:
Dim MS As New IO.MemoryStream() ugl.Save(MS, Infragistics.Win.UltraWinGrid.PropertyCategories.All) Return MS.ToArray()
Load:
Private Function ConvertToUltraGridLayout(data As Byte()) As UltraGridLayout Dim ugl As New UltraGridLayout() Dim MS As New IO.MemoryStream(data) MS.Seek(0, IO.SeekOrigin.Begin) ugl.Load(MS, Infragistics.Win.UltraWinGrid.PropertyCategories.All) Return ugl End Function dgrServices.DisplayLayout.CopyFrom(ConvertToUltraGridLayout(lOption.Layout))
What do I need to do to get the ListObject to be non-null?
Thanks!
Hello Robert,
Thank you for posting you our forum.
There could be multiple reasons because of that ListObject is null:
1) The row you are looking at is some old row that is no longer in the grid.
2) Another reason the ListObject might be null is for some "special" rows like the FilterRow, for example. So maybe your layout is turning on the FilterRow and so that would be correct.
3)There might have been a bug with 2013 Volume 1 that has since been resolved and you should test your application with 2018 Volume 1 to see if the same behavior is still reproduced
If you still getting the issue, the best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally.
Please let me know if you need further assistance.
Thanks Divya,
Your mention of a "special" row gave me the idea that I needed. The datasource never changed and neither did the rows that were in the grid, EXCEPT that the group by feature causes a different row hierarchy. Now I need to figure out the easiest way to get to the databound rows in the grid and skip over these special group by header rows.
Thanks,
Robert