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...

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;
  • 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 Feb 4 '15 at 17:40
  • My apologies. I missed that. Let me keep looking... – jpollar Feb 4 '15 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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