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.

2 Replies

AK Arseny Khutoriansky February 4, 2010 10:22 AM UTC

Sorry, the post for WinForms


RK Ranjeet Kumar Syncfusion Team February 5, 2010 10:40 AM UTC

Hi Arseniy,

Thanks for your interest in Syncfusion Products.

The sample attached contains a GridGroupingControl with three columns ID(int), FLAG(Boolean) and VAL(string) respectively. Column FLAG is of type CheckBox. To enable or disable VAL column's cell based on the checkbox state, I have handled QueryCellStyleInfo event as shown below in the code snippets.

To test the sample, run the sample and check or uncheck the checkbox and click on the corresponding cell of VAL Column.


// Event :

// Occurs for each cell before GridTableControl starts painting and lets users customize the display of cells.
this.gridGroupingControl1.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);

// Handler :

// To enable or disable VAL column cell
if (e.TableCellIdentity.ColIndex == 3)
{
// element displayed at the row of this cell
Element el = e.Style.TableCellIdentity.DisplayElement;
if (el != null && el.Kind == DisplayElementKind.Record)
{
// represents a record with data
Record r = el.GetRecord();
if (r == null)
return;

string st = r.GetValue("FLAG").ToString();

if (st.Equals("False"))
{
e.Style.Enabled = false;
}
}
}

Please find the sample attached from link mentioned below :

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F92791-1051601063.zip

Regards,
Ranjeet.

Loader.
Live Chat Icon For mobile
Up arrow icon