I have a fairly complex class hierarchy preparing column styles for my grid, and essentially end-up doing following (across multiple classes)
//parent class prepares an array of gridcolumns
GridBoundColumn gbc = new GridBoundColumn();
gbc.CellType = "ComboBox";
....
//a child class wants to make this column read-only
if (gbc.CellType != "CheckBox")
{
gbc.CellType = "Static"; //and other style changes
}
This all happens before gbc ever gets assigned
to any grid. Unfortunately reading CellType (inside that if statement) results in an exception, apparently trying to inherit style settings from a non-existent model.
Could this behavior perhaps be changed so when no model is yet know, style just returns its own value?
Gene Gorokhovsky
GridDataBoundGrid 1.6.1.6
AD
Administrator
Syncfusion Team
October 3, 2003 05:39 PM UTC
I will look into this. That's how it should normally be implemented that it won't try to locate a model if the style is not assigned to a model yet. You say that happens with any GridBoundColumn as long as it is not assigned to a GridBoundColumns Collection. Correct?
If that is the issue a workaround in the meantime would be to check style.HasCellType before accessing style.CellType.
Stefan
GG
Gene Gorokhovsky
October 3, 2003 05:46 PM UTC
>You say that happens with any GridBoundColumn as long as it is not assigned to a GridBoundColumns Collection. Correct?
>
Yes.
The suggested workaround does not help -- HasCellType returns true, and the damn thing still bombs.
AD
Administrator
Syncfusion Team
October 3, 2003 06:04 PM UTC
Ok, just tell me how to modify one of our samples to reproduce the problem. This helps me be sure I didn't misunderstand your setup.
Stefan