Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Enable an unbound Check Box based on a child rows value
posted

I have a grid where every row has an un-bound check box column appended to it.
I have disabled the check box when a simple condition (column in that row equals 1) exists on that row.
This is done on the initial data binding.

But, some of these rows have children with a seperate, bound check box that, when checked, need to over-ride the condition that set its parent to be disabled (above). 

Any ideas on how this can be done?  I have included a picture that may describe what I want a little better.  I have completed the initial disabling, now I just need to deal with the ignores.


grid description

 

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi,

    Looping through all the rows in the grid initially is probably not the most efficient way togo. And also, I assume you want the checkbox to become enabled again when the column it's based on no longer equals 1. 

    So what I recommend is that you using the InitializeRow event instead. This event fires for each row initially and it will also fire when a cell value in the rows changes. So you can check inside InitializeRow if the value of the other column ir a one or if the child row's Ignore is checked. 

    The only problem with this is that the InitializeRow for the parent row won't fire when you check of uncheck the value on the child row. But this is easily handled. All you have to do is trap the CellChange event and watch for changes to the CheckBox cell in the child row. When it changes, you call grid.Rows.Refresh(FireInitializeRow). 

Children