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

GGC, cell enabling/disabling

Hi,

I have table with 3 columns: ID(int), FLAG(bit) and VAL(string)
Column Flag is displayed as CheckBox automaticaly, because it is bit-type.


And I want that in each row cell of column VAL will be enabled, if the FLAG-cell is cheked(in this row) and
disabled, if the FLAG-cell is unchecked.

Please, give me some solution for this issue.

Thanks.

3 Replies

JJ Jisha Joy Syncfusion Team February 5, 2010 06:49 AM UTC

Hi Arseniy,

You could achieve the desired behavior by handling the QueryCellStyleInfo event. In this event you could set the styles of required cells based on the conditions.



void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "VAL")
{
Record r = e.TableCellIdentity.DisplayElement.GetRecord();
if (r != null)
{
if ((bool)r.GetValue("FLAG") == false)
{
e.Style.Enabled = false;

}

}
}

}
}




Please let me know if this helps.

Regards,
Jisha


AK Arseny Khutoriansky February 9, 2010 06:33 AM UTC

Thanks


JJ Jisha Joy Syncfusion Team February 9, 2010 08:34 AM UTC

Hi Arseniy,

Thank you for your update.

Thanks,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon