datagridview checkbox problem [modified]
-
Dear Friends, I have a datagridview in which there is parent child relationship in rows. I want that If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then the Parent row shouldn't gets uncheck and remains checked. I have tried to write the code for the same on CELLCONTENTCLICK event and on the CELLVALUECHANGEDEVENT but all in vain :(. Any kind of help will be appreciable. Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 2:02 AM
-
Dear Friends, I have a datagridview in which there is parent child relationship in rows. I want that If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then the Parent row shouldn't gets uncheck and remains checked. I have tried to write the code for the same on CELLCONTENTCLICK event and on the CELLVALUECHANGEDEVENT but all in vain :(. Any kind of help will be appreciable. Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 2:02 AM
Varun Sareen wrote:
I have a datagridview in which there is parent child relationship in rows. If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then that row doesn't gets uncheck and it again gets checked on itself.
Just keep toggling, I mean
If(checked)
uncheck;
else
check;Regards, Hiren.
My Recent Article: - Way to know which control have raised a postback
My Recent Tip/Trick: - Remove HTML Tag, get plain Text -
Varun Sareen wrote:
I have a datagridview in which there is parent child relationship in rows. If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then that row doesn't gets uncheck and it again gets checked on itself.
Just keep toggling, I mean
If(checked)
uncheck;
else
check;Regards, Hiren.
My Recent Article: - Way to know which control have raised a postback
My Recent Tip/Trick: - Remove HTML Tag, get plain TextThanks Hiren, for an immediate reply but i am sorry to say that I actually asked the wrong question (there was a little grammar mistake that made the question meaning other way around). Now I have corrected the question so now if you could look into it and provide me with some answer then that would be appreciable. Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 4:21 AM
-
Dear Friends, I have a datagridview in which there is parent child relationship in rows. I want that If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then the Parent row shouldn't gets uncheck and remains checked. I have tried to write the code for the same on CELLCONTENTCLICK event and on the CELLVALUECHANGEDEVENT but all in vain :(. Any kind of help will be appreciable. Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 2:02 AM
No clue off the top of my head how to do it, but... Look for some treeview examples that have tri-state checkboxes (they do pretty much what you want to do in your gridview...sort of). You may get some ideas looking at how they do it. (It's going to wind up being a matter of getting all the children and seeing if they're checked before dealing with the parent)