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

Standard Style overrides all others

The documentation implies that the styles are cascading, but it does not seem to be entirely true. For example, I've set the "Standard Style" to read-only=true, cell-type=Static, enabled=false. Then, I set individual cells to other properties, such as read-only=false, cell-type=currency|textbox|etc..., and enabled=true, and in the ChangeCells routine, I have use StyleModifyType.Override. My thinking was that the I could have all the cells static and read-only, except the cells I wanted to be editable. However, the end result is that all the cells are read-only and enabled=false, although the Cell-Type is not being ignored. Any thoughts? How can I best accomplish make all cells by default static/not enabled, EXCEPT specific cells? Eric Robishaw New to THE grid.

3 Replies

ER ERobishaw August 2, 2003 01:49 PM UTC

To further demonstrate this occurance, see the attached picture. I set the Standard style, celltype = Pushbutton, enabled=false, readonly=true. The non-pushbutton cells are set to various other styles, cell-type either static, textbox or currency... the textbox and currency cells set to read-only:false, and enabled:true. As you can see from the pic, the cell-style is NOT ignored, however the read-only and enabled properties are. HELP


AD Administrator Syncfusion Team August 2, 2003 01:58 PM UTC

If I drop a GridControl on a form, and place this code in form_load, then cell 2,2 is editable and all other cells are not.
private void gridControl1_Click(object sender, System.EventArgs e)
{
	this.gridControl1.BaseStylesMap["Standard"].StyleInfo.ReadOnly = true;
	this.gridControl1[2,2].ReadOnly = false;
}
Are you trying to do this for a GridDataBoundGrid? In a GridDataBoundGrid, you cannot directly set any cell specific properties except the CellValue (or Text). So you will have to handle the Model.QueryCellInfo event, and set the readonly property there for specific cells.
//hook the event
this.gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(grid_QueryCellInfo);

//the handler
private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
	if(e.ColIndex == 2 && e.RowIndex == 2)
		e.Style.ReadOnly = false;
}


ER ERobishaw August 2, 2003 03:02 PM UTC

Actually, not a regular grid. I found the problem though.... In the overriding styles I created (from the IDE), I hadn't explicity set the read-only and enabled properties... they were showing the defaults of false and true respectively, but after setting them they were BOLD, signifying explicit settings, and it now works. BTW, I assume you work for Syncfusion, but in any event, I've got to say-- Clay, you provide extreme, equisite, superb, succinct, impressive, and timely support for this product. Thanks Eric

Loader.
Up arrow icon