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.
Syncfusion Feedback

Single Cell Edit?

Thread ID:

Created:

Updated:

Platform:

Replies:

60900 May 15,2007 02:58 AM UTC May 16,2007 06:40 PM UTC Windows Forms 3
loading
Tags: GridControl
Pramod Viswanath
Asked On May 15, 2007 02:58 AM UTC

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.

haneefm [Syncfusion]
Replied On 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

Pramod Viswanath
Replied On 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

haneefm [Syncfusion]
Replied On 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

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.

Warning Icon 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.Close Icon

;