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

Disabling a cell

How do i disable a specific cell or change its colour in grid gruopuing control.
I am using QueryCellStyleInfo event but could not figure out how?

3 Replies

AD Administrator Syncfusion Team March 8, 2007 08:52 PM UTC

Hi Dinesh,

You can try this code to disable the cell(5,1) in a grid.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.Style.CellIdentity.RowIndex == 5 && e.Style.CellIdentity.ColIndex == 1)
{
e.Style.Enabled = false;
e.Style.BackColor = SystemColors.Control;
}
}

Best regards,
Haneef


DU dinesh upreti March 9, 2007 10:15 AM UTC

Thanks,
Another problem is that i want to access the columns via their name and not index. If you could help me on that, it would be great.


>Hi Dinesh,

You can try this code to disable the cell(5,1) in a grid.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.Style.CellIdentity.RowIndex == 5 && e.Style.CellIdentity.ColIndex == 1)
{
e.Style.Enabled = false;
e.Style.BackColor = SystemColors.Control;
}
}

Best regards,
Haneef


AD Administrator Syncfusion Team March 9, 2007 08:44 PM UTC

Hi Dinesh,

You can try this.

//QueryCellInfo event.
GridColumnDescriptor column = e.TableCellIdentity.Table.TableDescriptor.Columns["ColumnName"] as GridColumnDescriptor;

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon