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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem initialising GridControl with custom GridModel

Thread ID:





78383 Dec 11,2008 09:39 AM UTC Dec 12,2008 09:40 AM UTC WinForms 1
Tags: GridControl
James Sandys-Lumsdaine
Asked On December 11, 2008 09:39 AM UTC

I want to override some methods in the GridModel class and thought I could use my own CustomGridModel class in the constructor of my GridControl:

public class GridControlView : GridControl
public GridControlView()
: base(new CustomGridModel())

For some reason, by trying to initialise the GridModel myself (rather than passing in null), none of the resulting GridModel properties some be defaulted - I don't see row or column headers for example.

If I also try passing in new GridModel (the same thing occurs. However, if I pass in null to the base class all the properties are as I expect.

I have spent ages looking at the Syncfusion code and as far as I can see the GridControlBase.Model accessor lazily creates the GridModel if none is specified. I simply can not see how this lazily created instance could be initialised differently.

What I don't want to do is default all the properties myself on the GridModel before assigning it - there must be some way the default instance is initialised that I can hook into.

Many thanks,


Jisha Joy [Syncfusion]
Replied On December 12, 2008 09:40 AM UTC

Hi Jas,

The GridModel can be attached and replaced with another object at run-time. The GridControl class will remove any dependencies on the old model and set up a relationship with the new model.

When you replace the model, the grid control will completely refresh and draw the new cell data. Please see the following forum thread for more details.


Let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon