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

Expand button reset

Thread ID:





54573 Jan 11,2007 03:17 PM UTC Jan 26,2007 03:18 PM UTC WinForms 6
Tags: GridControl
Stuart Grimsell
Asked On January 11, 2007 03:17 PM UTC


I have a grid bound to a custom collection. All of the rows have the standard "+" to expand.

If the user expands a row where the objects child collection is empty the "+" disappears - as you would expect. However some processing in the app can add children to the node - and I need to allow the users to expand the row again.

The only way I have found of doing this is to do a complete Refresh - which I really want to do.

Any ideas anyone?

Administrator [Syncfusion]
Replied On January 12, 2007 04:48 AM UTC

Hi Stuart,

To set minus the expansion indicator when no children are present in the parent row of a hierarchical grid, you can handle the CellDrawn in the grid.

In the CellDrawn event handler, you check whether the row has a child list, and if it does, you check if the child list has members. The tricky part is that you can only getthe proper child count if the node is expanded. So, anytime there is an unexpanded node, the code does a 'silent' expand. Please refer to the attached sample for implementation.

Sample : PreventPlusSign.zip

Best Regards,

Stuart Grimsell
Replied On January 12, 2007 10:50 AM UTC


Sorry I want to do the complete opposite. I have added a child to a record that doesn't have the expand button indicated. I now want to give the user the option of expanding it - or doing it programmatically.

Stuart Grimsell
Replied On January 15, 2007 05:15 PM UTC

Anybody got any input?

Administrator [Syncfusion]
Replied On January 16, 2007 09:58 PM UTC

Hi Stuart,

Please try the attached sample and let me know if you are looking something different.

Best Regards,

Note: ParentID > 11 doesn't have the child row.

Stuart Grimsell
Replied On January 24, 2007 04:10 PM UTC

I have tried playing around with the samples as given and I am afraid they don't help much at all.

The "preventplussign.zip" is OK - but the issue still remains. A user clicks on a [-] and then a child gets added - there is no way to expand the node.

The ChildTableAddNewRow.zip works ( after a fashion ). I have removed some of the spurious code in the sample and have shown that it is the call to DataSet.AcceptChanges() that puts the [+] signs back in. I guess this just means that the dataset is sending a "reset" event into the grid. This also resets all the exapand states.

So it seems that the only way I can get the [+] symbol back is to refresh the grid ( which I would then have to do after every child add - not good ) - and manage all the expand states for the rows.

Surely there must be a better way to do this.

Stuart Grimsell
Replied On January 26, 2007 03:18 PM UTC

Solution found - but more info required.


I have managed to solve my problem and although I don't really like the solution it works.

Unfortunatly my solution requires me to do some paint work in CellDrawn ( like the sample you gave ). This is complicated by the fact that we are showing tree lines etc.

I have a set of parameters for areas to draw into, line sizes etc but am worried that these values are only correct for certain visual styles etc. I can't see anyway of getting information from the grid about the size and location of the [+] button or anything else so that I can be more dynamic and "safer" about my drawing code.

Any ideas how I can get the metric information about this drawing stuff?




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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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