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
close icon

Single Cell Edit?

In essential data grid, is there some kind of property to set so that all the cells in the grid except one can be made read only?

I am looking for a feature where in, I should just be passing a row number and column number for a cell which needs to be editable and the rest non-editable.

Thanks
Pramod.

3 Replies

HA haneefm Syncfusion Team May 15, 2007 05:18 PM UTC

Hi Pramod,

You can do this by handling the QueryCellInfo event of the grid and set the Style.ReadOnly property to true. Below is a code snippet.

this.gridDataBoundGrid1.Model.QueryCellInfo +=new GridQueryCellInfoEventHandler(Model_QueryCellInfo);

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.RowIndex == 2 && e.ColIndex == 2 )
e.Style.ReadOnly = false;
else
e.Style.ReadOnly = true;
}

Best regards,
Haneef


PV Pramod Viswanath May 16, 2007 02:55 AM UTC

Haneef.

Thanks a lot for this snippet. Is this possible with just the DataGrid provided by SyncFusion? Not the GridDataBoundGrid.

Thanks
Pramod.

>Hi Pramod,

You can do this by handling the QueryCellInfo event of the grid and set the Style.ReadOnly property to true. Below is a code snippet.

this.gridDataBoundGrid1.Model.QueryCellInfo +=new GridQueryCellInfoEventHandler(Model_QueryCellInfo);

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.RowIndex == 2 && e.ColIndex == 2 )
e.Style.ReadOnly = false;
else
e.Style.ReadOnly = true;
}

Best regards,
Haneef


HA haneefm Syncfusion Team May 16, 2007 06:40 PM UTC

Hi Pramod,

For GridGroupingGrid:

Please try this code.

this.gridGroupingControl1.QueryCellStyleInfo +=new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if( e.TableCellIdentity.RowIndex == 4
&& e.TableCellIdentity.ColIndex == 4)
{
e.Style.ReadOnly = false;
e.Style.BackColor = Color.Red;
}
else
e.Style.ReadOnly = true;
}

For GridControl :

You can try this code snippet to resolve this in a GridControl

this.gridControl1.QueryCellInfo +=new GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo);

private void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.RowIndex == 4
&& e.ColIndex == 4)
{
e.Style.ReadOnly = false;
}
else
e.Style.ReadOnly = true;
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon