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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting GGC cell to read only?

Thread ID:

Created:

Updated:

Platform:

Replies:

57015 Feb 23,2007 05:47 PM UTC Feb 26,2007 06:01 PM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2007 05:47 PM UTC

Hello,
How can I set specific cells and/or column/fields in GGC to read only?

Thanks

Administrator [Syncfusion]
Replied On February 24, 2007 02:03 AM UTC

Hi,

Thank you for being patience. The following are the techniques to make the cell / column to be readonly.

Column:
You can set the ReadOnly property for the required column using the following code snippet.

>>>>> >>>
this.gridGroupingControl1.TableDescriptor.Columns[2].ReadOnly = true;
>>>>> >>>

Specific Cells:
This can be achieved by two techniques. You can check for the e.Style.CellValue and accordingly set the cell to be ReadOnly. Another way is by retrieving the record and accordingly making the cell to be read only. The following is the code snippet.
>>>>>>>>>
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "sno")
{
Element el = e.TableCellIdentity.DisplayElement;
if (el != null && el.Kind == DisplayElementKind.Record)
{
Record r = el.GetRecord();
object value = r.GetValue("sno");
int s = (int)value;
if (s == 2)
e.Style.ReadOnly = true;
}
}
}
}
>>>>>>>>>

Readonly.zip

Kindly let us know if you need any further assistance.

Best Regards,
S.Shyam.

Administrator [Syncfusion]
Replied On February 26, 2007 06:01 PM UTC

Thank you!! I will try it.

>Hi,

Thank you for being patience. The following are the techniques to make the cell / column to be readonly.

Column:
You can set the ReadOnly property for the required column using the following code snippet.

>>>>> >>>
this.gridGroupingControl1.TableDescriptor.Columns[2].ReadOnly = true;
>>>>> >>>

Specific Cells:
This can be achieved by two techniques. You can check for the e.Style.CellValue and accordingly set the cell to be ReadOnly. Another way is by retrieving the record and accordingly making the cell to be read only. The following is the code snippet.
>>>>>>>>>
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "sno")
{
Element el = e.TableCellIdentity.DisplayElement;
if (el != null && el.Kind == DisplayElementKind.Record)
{
Record r = el.GetRecord();
object value = r.GetValue("sno");
int s = (int)value;
if (s == 2)
e.Style.ReadOnly = true;
}
}
}
}
>>>>>>>>>

Readonly.zip

Kindly let us know if you need any further assistance.

Best Regards,
S.Shyam.

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

;