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.

Setting GGC cell to read only?

Thread ID:

Created:

Updated:

Platform:

Replies:

57015 Feb 23,2007 12:47 PM Feb 26,2007 01:01 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2007 12:47 PM

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

Thanks

Administrator [Syncfusion]
Replied On February 23, 2007 09:03 PM

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 01:01 PM

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.

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.

;