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.

CellType reverting to default in virtual grid

Thread ID:

Created:

Updated:

Platform:

Replies:

30576 Jun 20,2005 02:28 PM Jun 21,2005 10:21 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 20, 2005 02:28 PM

I''m having a strange problem in my grid that may have been around for a while, but I''ve just noticed it and I''m really confused. My grid is virtual. We have about 9 or 10 custom cell types and all of them appear to be operating properly, except for one which happens to be our TextBox control. In the PrepareViewStyleInfo, I set the CellType for a group of cells to "MyTextBox". I''ve already added the MyTextBox to the grid''s CellModels and the constructor for our custom model is being called. Here''s where it gets weird. It''s clear that our renderer, associated with our TextBox is being used because if I make changes to the renderer, those changes appear in the cell. For example, if cell [2,2] is set to "MyTextBox" in PrepareViewStyleInfo(), if I check the GridStyleInfo at [2,2], it reports the CellType as "TextBox" which is the default and the model associated with the StyleInfo is the Syncfusion TextBox model, not our model. But clearly our renderer is being used. It doesn''t matter when I check the GridStyleInfo for the cell, it always returns the "TextBox". The problem is that we call ResizeToFit() against the column and the OnQueryPreferredClientSize() for our TextBox model isn''t being called. That''s how I discovered the problem. So I can''t set the column width properly because it''s not using our model. What I can''t figure out is how it could be using our renderer but not our model. Any ideas? Is it possible it''s somehow getting reverted to the default? Thanks. Pete

Administrator [Syncfusion]
Replied On June 20, 2005 03:59 PM

PrepareViewStyleInfo happens late in the drawing process and may not happen at all in some other situtations where a cell style is needed (like resizing). For example, if you want to set a cell to be readOnly using a style, then you cannot set this in PrepareViewStyleInfo. It must be set in QueryCellInfo so the ReadOnly property is set before it is used. So, you might try moving the code that sets the CellType down into QueryCellInfo.

Administrator [Syncfusion]
Replied On June 20, 2005 05:17 PM

Clay, That makes sense. I guess that is an area of some confusion. Is there documentation, or could documentation be produced that specifies which things should be handled in PrepareViewStyleInfo and which should be handled in QueryCellInfo? It seems clear that certain GridStyleInfo properties need to be set in one or the other and for some properties, it doesn''t seem to matter. For other''s, like this one, it''s a bit unclear. Thanks. Pete

Administrator [Syncfusion]
Replied On June 20, 2005 06:51 PM

Here are a couple of KB links. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=96 http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=95

Administrator [Syncfusion]
Replied On June 21, 2005 10:21 AM

Clay, Thanks, the first was very helpful. The second one was about making read only cells in DataBound grids... But the first does answer a lot of questions for me. Thanks. Pete

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.

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.

;