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

Initializing GridDataBoundGrid

Hi - I'm hoping there's a final event that fires to signal that initialization of the grid is complete after setting the datasource... I'm interesting in capturing changes in the column widths, but only after the grid has finished initializing and is available to the user. Thanks!

9 Replies

IP Ivan Pelly February 6, 2003 07:48 PM UTC

> Hi - I'm hoping there's a final event that fires to signal that initialization of the grid is complete after setting the datasource... I'm interesting in capturing changes in the column widths, but only after the grid has finished initializing and is available to the user. Thanks! > P.S. It seem that more events continue to fire after the grid becomes visible - I'd like to know when these events are finished, too.


AD Administrator Syncfusion Team February 6, 2003 07:55 PM UTC

The VisibleChanged event will be fired once the grid has been made visible. Is that good? Can't think of other events right now. If you have source code version you might just enable Tracing with a .config file. The GridPad sample has a .config file with some TraceSwitches that you can turn on for tracing. More TraceSwitches can be found in switches.cs Stefan


IP Ivan Pelly February 6, 2003 08:06 PM UTC

I don't have the sourcecode version :( There seem to be more events that fire after VisibleChanged. My problem is that Model_ColWidthsChanged fires a lot, even after VisibleChanged. So there's no "I'm done initializing and just sitting here waiting for the user to interact with me" event?


IP Ivan Pelly February 6, 2003 08:08 PM UTC

Part II - I really need a place where I can programmatically set the widths of the columns AFTER the grid has finished all its internal convulsions and column-width setting. Thanks again.


AD Administrator Syncfusion Team February 6, 2003 08:31 PM UTC

The grid does not know what is being called from the Parent Forms code after the data source was set. Also, the grid does not know in which order proerties are beeing set. What we do in the grid is we implemented the ISupportInitialize interface. That way the Windows Forms designers will add BeginInit and EndInit call inside the InitializeComponent method and we can do some initialization when the grids EndInit method is called. You could derive your own grid and implement ISupportInitialize. However, since you have full control of the parent form you could just fire a method call to the grid after the Forms InitializeComponent method returns or at the end of the Forms OnLoad method. Stefan


IP Ivan Pelly February 7, 2003 08:00 PM UTC

It looks like ColWidthsChanged continues to fire (at least one more time) after the Form's OnLoad finishes. Would you have any more suggestions? Thanks again.


AD Administrator Syncfusion Team February 7, 2003 11:27 PM UTC

Here's something I think will work, though it is not very elegant. Hook the grid_Paint event in Form_Load. Then in the Paint event, do two things. First, unhook the grid_Paint event so this code in the event handler is only executed once. Second, hook the ColWidthsChanged event so you will receive notification of widths changing after the first time the grid is painted.


IP Ivan Pelly February 11, 2003 12:49 PM UTC

Thanks for the suggestion. I'm not sure though what you mean by "hook". Could you give a quick example? Thanks!


AD Administrator Syncfusion Team February 11, 2003 01:57 PM UTC

I think Clay just meant to setup a event handler, e.g. grid.Paint += new PaintEventHandler(gridPaint); Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon