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
close icon

Attaching a GridModel to a GridControl

Hello,

I would like to be able to create a single view and change the model used by the view during runtime.

This code:

GridModel model = new GridModel();
gridControl1.ResetVolatileData();
model.QueryCellInfo += new GridQueryCellInfoEventHandler(GridQueryCellInfo);
gridControl1.Attach(model);

Gives me a blank form when run. What else do I need to call beyond Attach(model)?

The attached file shows the code working when the model is removed and the handlers are attached directly to the GridControl.

Cheers,
Ben

SeperateModelTest.zip

1 Reply

HA haneefm Syncfusion Team May 29, 2007 03:48 PM UTC

Hi Ben,

You can try setting the DefaultSize of the rows and columns in a GridModel. Here is a code snippet

model.Rows.DefaultSize = 19;
model.Cols.DefaultSize = 65;

gridControl1.Attach(model);

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon