Hi
I have a wingrid that is bound to a datasource
initially the datasource is empty and nothing, including the column headers is displayed in it
a button loads a screen that allows the creation of an item, when this window is exited, the data for the wingrid is requeried from the datasource and it is displayed, but not in the format that was defined at design time, in I guess raw format showing all columns
I have attempted to use the wingrid.DisplayLayout.save in pre-bound and post-bound states to preserve the layout (when the datasource is empty) and then load the layout once the datasource has data, but I still get the raw all column layout.
at what point should I save the layout as it seems the layout isnt initialising when the datasource is empty and when I rebind it looses the layout anyway.
Please help!
Larry said:at what point should I save the layout
I have worked out what my problem is.
when binding to an empty LinqtoSQL entity list, it appears to wipe the grid format, so when you rebind to a populated list, the format is empty and you get all the columns displayed
to get round this I simply check that the lists.count > 0 and only bind if it is
Many Thanks
Hi,
That makes sense. If you bind to an empty list, the BindingManager in DotNet has no way to determine the data structure, so you are essentially binding to a DataSource with no columns. This obviously does not match up with the existing columns in the grid, to the grid assumes you are binding to a new data structure and the layout is lost.