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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TableControlCheckBoxClick and preventing specific rows from being ''checkable''

Thread ID:

Created:

Updated:

Platform:

Replies:

54080 Dec 29,2006 04:31 AM UTC Jan 3,2007 10:06 PM UTC WinForms 1
loading
Tags: Grouping
James Blibo
Asked On December 29, 2006 04:31 AM UTC

I have a checkbox in the first column (header and records).

How do I prevent specific rows from being checkable.

For example, when the user attempts to check row 3, I want to prevent that row from being check if the 'Status' of that row record is set to 'inactive', for example. Likewise, I want to skip over this row when the user check the header to checks all the records in the grid.

I know that I can do it from the TableControlCheckBoxClick event via e.Inner.Cancel = true, but I am not sure if style.TableCellIdentity.RowIndex directly maps to the row index of the underlying datasource, given the fact that the grid is sortable, ect..

Administrator [Syncfusion]
Replied On January 3, 2007 10:06 PM UTC

Hi James,

Thank you for being patience.

The idea to skip and disable the checkbox whose row is inactive is by handling the QueryCellStyleInfo event and set the corresponding checkbox to be disabled.

For example, in the following code snippet the column 'Col2' decides the row being inactive or active
>>>>>>>>>>>>>>>Code Snippet<<<<<<<<<<<<<<<<<<<
private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if(e.TableCellIdentity.Column.Name.Equals("Col0"))
{
Element el = e.TableCellIdentity.DisplayElement;
if(el != null && el.Kind == DisplayElementKind.Record)
{
Record r = el.GetRecord();
string key;
if (r != null && r.GetValue("Col2") != null)
{
key = r.GetValue("Col2").ToString();
if(key.Equals("inactive"))
{
e.Style.CellValue = false;
e.Style.Enabled = false;
e.Handled = true;
}
}
}
}
}
}
>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<

Sample: GGC_CheckBoxIssue.zip

The following KB article demonstrates the technique to have check box in header cell
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=346

Please try the above the code snippet and let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


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

;