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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem initialising GridControl with custom GridModel

Thread ID:

Created:

Updated:

Platform:

Replies:

78383 Dec 11,2008 09:39 AM UTC Dec 12,2008 09:40 AM UTC Windows Forms 1
loading
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,

Jas.


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.

http://www.syncfusion.com/Support/Forums/message.aspx?&MessageID=50545

Let me know if this helps.

Regards,
Jisha


CONFIRMATION

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.

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

;