Setting GGC cell to read only?
Hello,
How can I set specific cells and/or column/fields in GGC to read only?
Thanks
How can I set specific cells and/or column/fields in GGC to read only?
Thanks
SIGN IN To post a reply.
2 Replies
AD
Administrator
Syncfusion Team
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.
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.
AD
Administrator
Syncfusion Team
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.
>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.
SIGN IN To post a reply.
- 2 Replies
- 1 Participant
-
AD Administrator
- Feb 23, 2007 05:47 PM UTC
- Feb 26, 2007 06:01 PM UTC