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

enabling checkbox

Thread ID:

Created:

Updated:

Platform:

Replies:

43982 May 10,2006 11:29 AM UTC May 12,2006 06:47 AM UTC WinForms 4
loading
Tags: GridControl
cheryl
Asked On May 10, 2006 11:29 AM UTC

Hello All, if a column from datasource has a value of 1 the unbound checkbox column for that record should be enabled and if it''s 0 it should be disabled ...... What could the solution be ? Thanx

Administrator [Syncfusion]
Replied On May 10, 2006 01:08 PM UTC

Hi Cheryl, You need to handle the QueryCellStyleInfo event to enable/disable the record in a groupingrid.Here is a code snippet. Record r = e.TableCellIdentity.DisplayElement.ParentRecord; if( r != null) { object obj = r.GetValue("Check"); //Check is the name of the unbound check box column if( obj != null && obj.ToString() != string.Empty) { int checkValue = (int)obj; if( checkValue == 1) { e.Style.Enabled = true; } else e.Style.Enabled = false; } } Please let me know if this helps. Thanks for your interest in Syncfusion Products. Best Regards, Haneef

cheryl
Replied On May 11, 2006 06:25 AM UTC

hello haneef I''ll rephrase the question if a column from datasource has a value of 1 the unbound checkbox column for that record should be checked on form load and if it''''s 0 it should be unchecked ...... What could the solution be ? Thanx >Hi Cheryl, > >You need to handle the QueryCellStyleInfo event to enable/disable the record in a groupingrid.Here is a code snippet. > >Record r = e.TableCellIdentity.DisplayElement.ParentRecord; >if( r != null) >{ > object obj = r.GetValue("Check"); //Check is the name of the unbound check box column > if( obj != null && obj.ToString() != string.Empty) > { > int checkValue = (int)obj; > if( checkValue == 1) > { > e.Style.Enabled = true; > } > else > e.Style.Enabled = false; > > } >} > >Please let me know if this helps. > >Thanks for your interest in Syncfusion Products. >Best Regards, >Haneef > >

Administrator [Syncfusion]
Replied On May 11, 2006 09:33 AM UTC

Hi Cheryl Through the Record.GetValue() method the value of the record can be retrieved. Here is a small sample which gets the value from a bound column(from Datasource) in a grid (the column name is ''value'') and changes the value of the unboundcheckbox column (the column name is ''CheckBox'' ) in a grid. In the QueryCellStyleInfo event, the record''s value is retrieved as an object(o). With the object, the value of the unboundcheckbox column is changed through Record.SetValue() method. The code for the QueryCellStyleInfo event is as follows. Record r = e.TableCellIdentity.DisplayElement.ParentRecord; if( r != null) { object obj = r.GetValue("Value"); if( obj != null && obj.ToString() != string.Empty) { int checkValue = (int)obj; if( checkValue == 1) { r.SetValue("CheckBox","True");//Set the value of unbound column; } else r.SetValue("CheckBox","False");//Set the value of unbound column } } Here is a sample. http://www.syncfusion.com/Support/user/uploads/UnboundCheckboxGridGroup_CS_b9ba14f1.zip Please let me know if i am missing something. Thanks for your interest in Syncfusion Products. Best Regards, Haneef

cheryl
Replied On May 12, 2006 06:47 AM UTC

hello haneef it''s working perfectly .......... thanx a lot >Hi Cheryl > >Through the Record.GetValue() method the value of the record can be retrieved. Here is a small sample which gets the value from a bound column(from Datasource) in a grid (the column name is ''value'') and changes the value of the unboundcheckbox column (the column name is ''CheckBox'' ) in a grid. In the QueryCellStyleInfo event, the record''s value is retrieved as an object(o). With the object, the value of the unboundcheckbox column is changed through Record.SetValue() method. The code for the QueryCellStyleInfo event is as follows. > >Record r = e.TableCellIdentity.DisplayElement.ParentRecord; >if( r != null) >{ > object obj = r.GetValue("Value"); > if( obj != null && obj.ToString() != string.Empty) > { > int checkValue = (int)obj; > if( checkValue == 1) > { > r.SetValue("CheckBox","True");//Set the value of unbound column; > } > else > r.SetValue("CheckBox","False");//Set the value of unbound column > } >} > >Here is a sample. >http://www.syncfusion.com/Support/user/uploads/UnboundCheckboxGridGroup_CS_b9ba14f1.zip > >Please let me know if i am missing something. > >Thanks for your interest in Syncfusion Products. >Best Regards, >Haneef

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

;