The strangest thing has happened, and I don't really know how to fix it.
I have an application that shows 14 WinGrids. Each one of these displays a different piece of data to the user and all are bound to .NET Binding Sources for their data.
All of the grids show their data, and up until recently, all of them showed the SUM summary row in their respective columns.
Up until recently, this all worked just fine. At some point, however, in some version that I have developed, all of the SUM summaries disappeared. Thinking this was just the Windows Forms Designer messing with stuff it shouldn't (which seems to happen), I re-added all of the summaries to all of the grids' bands. These all show up in design-view, but when I actually run the application, they do not show up. I have created a test application to make sure that it was not something on my machine, and that seems to work fine. I have also removed all controls from the form and added a single grid and bound it to one of my binding sources, and it also does not show the summary row.
I am using NetAdvantage 8.1 Win CLR2x in my solution.
Help!
If the summaries show up at design-time and not at run-time, then something in the code must be removing them.
Are you losing anything else? For example, if you change the width of a column in the grid at design-time, does it maintain that same width when you run the application?
Perhaps your project is loading a saved layout into the grid at run-time?
Hey Mike,
Using the 2009.2 version and I have exactly the same problem. A grid at design time has summaries but at run time they are not shown which is mind boggling. There is no code behind for this particular grid, just a simple grid, bound to a BindingList (displays data fine) and has on the bottom some sums. They are nowhere to be found when I run the application although they do appear in the designer.
If your data structure at design-time doesn't match the structure you bind to at run-time, then you will lost all layout-level properties in the grid.
I can't see any reason why you would ever lose the summaries and not other things like the column order or column width (assuming you set any of this at design-time).
So the first thing I recommend is that you try changing the width of a column at design-time in some obvious-to-see way, like make one column very wide and see if the column width is maintained at run-time.
If it is not, then you are losing your layout, which means your data structure isn't matching up.
If the column width is maintained and the summaries are lost, then something else is going on. In that case, if you can provide a small sample project demonstrating this, I'd be happy to take a look at it.
Hi,
This isn't at all related to the initial post here. Your entire layout is being lost because the Key of the band you created at design-time does not match the key of the band you are getting from the DataSource at run-time.
Set the Key of the band to "List`1" (which is what the DotNet BindingManager is using for the name of the band in this case) and it works fine.
You might want to check out this KB article for more info.
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
I've seen the same problem.Here's a sample project.
Well, it's impossible to guess why the summaries are being lost without seeing it in action, since I don't know how you are creating your layout at design-time and when/how you are binding the grid at run-time.
If you can create a sample demonstrating the problem with the BindingList, I'd be happy to check it out and see if I can find out why it's losing the summaries.
I've never heard of the grid losing part of the layout and keeping other parts. That doesn't make any sense at all.
Any change I am making at design time is maintained but the summaries. Looking through the generated code I can verify that the summaries are added with the something along the lines of
gridBand.Summaries.AddRange(summarySettingssArray)
grid.DisplayLayout.BandsSerializer.Add(gridBand)
but if I immediately look in grid.DisplayLayout.Bands[0].Summaries there is nothing, the collection is empty.
Nevertheless, I do have some other grids that seem to be working just fine with summaries, the only difference between those and this one with run away summaries is that all the other are using an UltraDataSource control as the datasource for the grid whereas the problematic one was using a BindingList. Switching to UltraDataSource solved the problem. I should mention that other than the summaries the grid was functioning correctly with the BindingList, rows were getting displayed, updates were getting through.
I don't know what to make of that!