Default Collapse on Telerik Radgrid

I got a bug list this week by user that i working on now as my freelance job. They asked me to put by default all the grid is collapse instead of expand like was previously installed on their server.

The grid component that i used currently is Telerik, because the client have a licence on that and they also want me to use that component as well to implement on their Sharepoint.

I do googling to find how to set that, this is the best solution that i got and the solution it is must be using a code.

Here is below the code :

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        foreach (GridGroupHeaderItem groupHeader in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
        {
                GridItem[] children = groupHeader.GetChildItems();
                foreach (GridItem child in children)
                {
                    if (child.Expanded)
                        child.Expanded = false;
                }
        }
    }

i got this tip form this url : http://www.telerik.com/forums/collapsed-hierarchy-by-default-when-grouped

And here as below the sample screenshot after i deployed that code :

collapseetelerik

Happy Sharepoint-Ing

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.