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. Image for the cookie policy date

How do i indent/outdent rows in griddatabound hierachy

Hi,

i am using a griddatabound control, for displaying items in hierachial structure and i have requirement to indent/outdent the rows. i,e by clikcing on indent, the child should become the parent and parent to chils.

is it possible using Griddataboundgrid or please suggest an alternative.

thanks

Saumya


1 Reply

CI Christopher Issac Sunder K Syncfusion Team May 24, 2011 06:11 PM UTC

Hi Saumya,

Thank you for your interest in Syncfusion products.

You can use GridGroupingControl for displaying hierarchical levels which will give us better clarifications than GridDataBoundGrid. I have created a sample for GridGroupingControl. You can make use of the below method to swap parents and children. Likewise, you can modify the method as per your application.

static void MoveCollectionItem(IList list, int oldIndex, int newIndex)
{
var temp = list[oldIndex];

if (newIndex > oldIndex)
for (var i = oldIndex; i < newIndex; ++i)
list[i] = list[i + 1];

if (newIndex < oldIndex)
for (var i = oldIndex; i > newIndex; --i)
list[i] = list[i - 1];

list[newIndex] = temp;
}

Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=SyncFusionGridProblem-1920350998.zip

Let me know if you have any other concerns.

Regards,
Christo.




Loader.
Live Chat Icon For mobile
Up arrow icon