1

Is there a way to display a dataview control with multiple level grouping on a custom web part, not using SPD.

Right now, I'm using SPGridView control but It does not support multiple level grouping. I'm querying the data from several lists.

I want something like this, or even more than 2 levels:

- Business Area I
  - Area A
     Item 1
     Item 2   
  + Area B   
  + Area C
+ Business Area II

But I'm afraid I have to use JQuery plugin or something else...

4
  • Can you post the code you are using?
    – jpollar
    Commented Feb 4, 2015 at 17:43
  • Why not use a TreeView control Commented Feb 10, 2015 at 5:40
  • That solves the multilevel grouping, but I want it to display as a dataview with multiple columns, like when you work on a single list and display the data with OOTB views.
    – agzertuche
    Commented Feb 10, 2015 at 17:53
  • Create a tabular format view then use jQuery datatable with grouping plugin. See example here: jquery-datatables-row-grouping.googlecode.com/svn/trunk/…
    – Aveenav
    Commented Feb 10, 2015 at 21:35

1 Answer 1

1

SharePoint:ListViewByQuery might do the trick.

I found this example: https://social.msdn.microsoft.com/Forums/sharepoint/en-US/906a43a4-2724-45de-b1ab-285f64229e83/multi-level-grouping-in-spgridview-programmatically

<SharePoint:ListViewByQuery ID="CustomersListViewByQuery" runat="server" Width="700px" />

In Code behind

SPList oList = web.GetList("CustomTask");

CustomersListViewByQuery.List = oList;

SPQuery query = new SPQuery(oList.DefaultView);

query.Query= "<GroupBy Collapse='FALSE'><FieldRef Name='Department' /><FieldRef Name='Status' /></GroupBy>";

CustomersListViewByQuery.Query = query;
2
  • Thanks buddy, but this method works when you use only one list, but I'm getting my data from several lists (as I mentioned on the question)...
    – agzertuche
    Commented Feb 4, 2015 at 17:40
  • My apologies. I missed that. Let me keep looking...
    – jpollar
    Commented Feb 4, 2015 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.