We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date


I would like to save grid col widths and grid column order of a syncfusion grid. I just used the example posted in http://www.syncfusion.com/Support/article.aspx?id=574. The preferences are saved when the user closed the form. I did it in Form closing event. The method works most of the time. But sometimes doesn''t work. When it doesn''t work, i check Model.ColCount it''s zero and datasource is nothing and GridBoundColumns is nothing. Everything is cleaned out. I think since form is closing, all resources and datastructres are cleared. I tried both form closing and form closed event. What''s the solution for this?

3 Replies

AD Administrator Syncfusion Team December 17, 2004 10:33 PM UTC

I would have thought Form.Closing would work unless you are explicitly destroying the grid. You might try saving the grid in your Form''s Dispose override. protected override void Dispose( bool disposing ) { if( disposing ) { //save the grid here if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }

SR Shankar Ramasubramanian December 20, 2004 05:22 PM UTC

Clay, Thanks. Ideally, I would like to save the preference when form is closing, that is form closing event. My question is why should the databound grid release all the resources when form is not closed. Is this something windows form issue or syncfusion issue. thanks --shankar

AD Administrator Syncfusion Team December 20, 2004 08:16 PM UTC

The only control that I can think of that may release a grid is a GridrecordNavigationControl or a TabBarSplitterWndControl. When you close a pane in one of these controls, a grid is destroyed. Are you using either of these controls to hold your grid? If you own the source ocde, you can use the Assembly Manager (Syncfusion Start menu) to build a debug version of the libraires, and then put a stop in the GridDataBoundGrid.Disposing method to try to spot exactly what might be dispsoing of the grid. If you upload a sample showing the problem, we can try to debug it here.

Live Chat Icon For mobile
Up arrow icon