Click here to Skip to main content
15,892,517 members
Everything / Grouping

Grouping

grouping

Great Reads

by ASP.NET Community
The ListView control is a new data presentation control that was added to .Net 3.5 , you may wonder why its added to the framework , and what it
by VallarasuS
Custom ICollection View to group items based on two or more properties in same level
by ASP.NET Community
Some people think that the ListVew is a better Repeater and is one the best new additions to Visual Studio 2008.Blogs/ArticlesUsing the
by Robert.Verpalen
DataGridViewGrouper: add grouping functionality to the .NET DataGridView

Latest Articles

by Robert.Verpalen
DataGridViewGrouper: add grouping functionality to the .NET DataGridView
by ASP.NET Community
The ListView control is a new data presentation control that was added to .Net 3.5 , you may wonder why its added to the framework , and what it
by ASP.NET Community
While answering forums I come across a post “Grouping the data in the data table” which lead me to write this short code snippet for that post.
by ASP.NET Community
Some people think that the ListVew is a better Repeater and is one the best new additions to Visual Studio 2008.Blogs/ArticlesUsing the

All Articles

Sort by Score

Grouping 

11 Oct 2013 by ASP.NET Community
  The ListView control is a new data presentation control that was added to .Net 3.5 , you may wonder why its added to the framework , and what it
30 Dec 2011 by VallarasuS
Custom ICollection View to group items based on two or more properties in same level
5 Dec 2012 by amrita_thakur
Hi...I have a WPF Datagrid which I've grouped by a column ProductName. I want to perform sorting on UploadDate which is a datefield. The issue here is on clicking on sort I want the data to be sorted on UploadDate within the groups, by the datagrid sorts the data based on the ProductName, on...
12 May 2014 by Nelek
Supposing all strings are always equal in format (and using pseudo code):declare a variable to save the last checked numbermake a loop that go through the list get the current element extract the last block of numbers transform the last block of numbers into a number if...
10 May 2014 by Emre Ataseven
I'm sure it is not best way but it is working, maybe it gives you a hint to fix it or find your own method;First, let's fill list with dummy values;List list = new List();Enumerable.Range(0, 10).ToList().ForEach(p => list.Add("S1-00-" + (p +...
19 Oct 2015 by Sreekanth Mothukuru
This query should fix your problem:select ROW_NUMBER() over (ORDER BY Min(id)) AS Number, name, cast( min(year) as varchar(100)) + ' - ' + cast(max(year) as varchar(100)) as yearsfrom ( select e.*, (year - row_number() over (partition by name order by year)) as grp from tblStudent e)...
19 Oct 2015 by jaket-cp
Using your year - row_number() over, you could do an additional modulus calculation of 3 and then filter with 0.Something like this:with events as(--setup dummy data select 1 id, 'Arun' name, 2001 year union all select 2, 'Arun', 2002 union all select 3, 'Arun',...
17 May 2016 by George Jonsson
It's a bit late and I had a beer or two, but I think this will work for you.My additions to your XSL is in bold.
24 May 2016 by George Jonsson
The problem was that you need to walk up the tree and select productgroup, then go down the tree again to find all lines.Modified XSD K8 order creation control file ...
10 Nov 2017 by OriginalGriff
See here: SQL GROUP By and the "Column 'name' is invalid in the select list because..." error[^]
16 Feb 2021 by Maciej Los
Quote: There must be exactly two rows that denote the best and the worst ratio. Sorry, but you're wrong. There can be more than two rows, because the same ratio is able to achieve more than one city. So, the proper way to achieve that is to...
29 Mar 2022 by Maciej Los
Well, you can use Linq. See: void Main() { XDocument xdoc = GetXmlData(); var result = xdoc.Descendants("rf") .GroupBy(x => new {CC = x.Value.Equals("CC"), Att = x.Value.Equals("Att")}) .ToList(); result.Dump(); } // Define other methods...
19 Jan 2012 by karthikkaliber
Hello,Below is the code currently i am using for grouping in listview. I am able to group records, but when user clicks on the button(AddNewCluster) to create new group with set of records i am unable to concatenate with the old records. The listview gets updated with the new group and...
19 Jan 2012 by karthikkaliber
Solved my self thanks!!! i added a ObservableCollection and thn added to ListCollectionView!!! i am able to achive my task !!! thanks
11 Mar 2012 by amrutd
I have problem while grouping in listbox. Actually my table structure is as follows.Emp_ID EmpName EmpParent_ID1000002 Vivek 10000051000003 Rohit 10000051000005 Ajay 10000311000006 Sanjay 10000051000011 Hemant -11000022 Amit 10000051000024 Aakash ...
28 Mar 2012 by fealbernaz
It is very simple, are you using Entity Framework or Storage Procedure or simple select ?either way you can filter on databaseon your select just put something like that select distinct(EmpName),Emp_ID, EmpParent_ID from TABLENAME group by EmpNameor you can use LINQexample...
30 May 2012 by bhagirathimfs
these links may help youGrouping GridviewGroupedGridview - A Customized GridView Control[^]GroupGridView[^]Group Total and Sub TotalGroup Total[^]Sub Total[^]
8 Aug 2012 by tanishtaman
Hello All,I am facing an prob please help.I have following class.class Product{ public int ProdCode { get; set; } public decimal NetAmount { get; set; } public List BillDetailIds { get; set; }}In db there are two tables:Table 1: Master table...
22 Aug 2012 by mynkmitl
I am having rows grouped into expanders based on category:empName in datagrid control of WPF application and we want to shift the expander on collapsed event to last of datagrid and vice versa i.e. shift the group to top in expanded event. Tried several ways but for no avail yet. Please suggest....
20 Nov 2012 by Member 9581488
Assign Group on the field where you want to have group by vendorID.at the bottom of the report U can see Columns groups and Row groups
27 Nov 2012 by HCIMS DEVELOPER
How to add anchor tag with an onclick function to an sjg:gridwhen i used like this its working groupText="['Detail for order number : {0} which contains {1} item(s)']"but I need anchor tag with onclick="addData({0},{1})" , after the item(s){0} is a string
29 Mar 2013 by jagdish123061
I have 3 tables1) TM_Company (compID,CompName)2) tm_Customer(custId,CName,CompID)3) tm_booking(bID,Amount,CustID,CompID)data in table 1) tm_Company1, abc2, def3, xyz2) tm_customer1, jagdish,12, ghi, 13, jkl, 14, iuy, 25, lkj, 26,...
29 Mar 2013 by Dnyaneshwar Kondbale
You write one query which is retriving data for you likeselect Co.CompanyID,Co.CompanyName,Cu.CustId,Cu.CName,B.bID,B.Amount fromTM_Company Co inner join TM_Customer Cu on Co.CompID=Cu.CompID inner join Tm_Booking on cu.Custid=B.CustId and Co.CompID = b.CompIDwhere co.CompID='Selected...
19 Jun 2013 by Nathan Going
I stumbled across something very interesting http://www.1upindustries.com/Bins/Default.aspx[^]. Is it an application that is pinned to the bar and renders it's icon based on its contents, then also renders a hover menu with thumbnail to simulate the windows taskbar? What about the handles...
7 Jul 2013 by Member 10114688
i have a tableLayoutPanel that contains 22 radiobuttons.i wanna group these radiobuttons by twos.Can i group in codebehind in C#?
7 Jul 2013 by OriginalGriff
Yes: Just put them inside a different control: a GroupBox[^] is a good choice.RadioButtons automatically act as a group within a single control, so if each set of two is in a separate GroupBox they will affect only each other.
27 Aug 2013 by milkncookiez
I've got quite some challenge in here...Is it possible to have an XSL code that will apply to whatever hierarchy of XML, to transform it into nested HTML list?Example XML: ...
27 Aug 2013 by woopsydoozy
This gets you close without much effort. Not sure how/why you're filtering out some of your elements, and your use of an index in your desired output is inconsistent, so left that out:
27 Aug 2013 by milkncookiez
The above solution is working fine, but it doesn't leave place for manipulating the output by adding other HTML tags. Because for example I need to put, for the child elements, and .Here is what I ended up with: ...
4 Sep 2013 by Pheonyx
Hi Guys,So I am attempting to group data in the Listbox in my MVVM WPF application.I have read both the following links which is where I have sourced how to start this from:mvvm-grouping-items-in-listview[^]karl shifflett -...
6 Sep 2013 by Gynehs
I know in SQL, you need to specify what are the attributes you want to select and find out if those attributes are similar, like you can count all records that have same values in column a, b and c. What I'm asking is ,it possible to search all records to see what records have similar...
6 Sep 2013 by cigwork
Do you mean that you want to find the number of rows (groups) where you have two or more attributes that are identical? As below?-- Some dummy data to demonstrate.create table test( a varchar(10) null, b varchar(10) null, c varchar(10) null, d varchar(10) null, e...
6 Sep 2013 by H.Brydon
Well, your question is vague but any way it is interpreted, the answer is "yes".I believe you want to ask Google about "Map reduce" and apply it to your data while reading each of the records.
30 Sep 2013 by Member 10306643
I'm trying to display data for two types of procedures. One procedure displays all the centers when clicked on a button. the other displays a specific center based on the value member. In this case the value member is the project ID.The problem occurs when I click on the button to retrieve...
30 Sep 2013 by Singh Gyan
i think for that you need to create two different dataset cocntaing all the relative data and bind them together to show in the report
11 Oct 2013 by ASP.NET Community
Some people think that the ListVew is a better Repeater and is one the best new additions to Visual Studio 2008.Blogs/ArticlesUsing the
12 Oct 2013 by Member 10331742
Datagridviewde Gruplandırma nasıl yapılır?ben muterı borç takip adlı bır program yapıyorum ımdı aynı musterıyı ard arda kaydederken alt alta geıcyr buda kalabalık yapıyor bnde bunu aynı ıım soyısıme sahıp olanları alt alta degıle ıc ıce atmasını ıstyrm bunu nasıl yapabıırım ? orenek resım...
19 Oct 2013 by jamiebones
Hello please have run into problems with linq to entities. Am working on a school management system.I can generate from the database the record of each student and the student scores from and this is binded to a gridview control. Below is the code i use in generating the student scores ...
6 Dec 2013 by OriginalGriff
Try:var items = from fi in (from f in files select new FileInfo(f)) select new string[] { fi.Name, // Name fi.FullName, // Directory fi.CreationTime.ToString(), // Date Modified ...
2 Jan 2014 by Sana Saeed
I have a main report in Crystal reports of visual studio 2010.It is group with RecipeDate and inside its header there is a subreport.In subreport there is a IssueDate.I want to show all the issuance in the subreport issued right after/on RecipeDate but before the next RecipeDate. For...
2 Jan 2014 by thatraja
Check this tutorial & customize itC# Crystal Reports - Date to Date[^]EDIT----------------How to pass a date range to a subreport using a parameter[^]Business Reporting: Passing date parameters into a sub report[^]
13 Jan 2014 by Member 10475792
I have a Complex Situation now and i am terribly stuck. Kindly Let me know if you can share some light to it.I have a List Which will have the Following propertiespublic class Categories { public string DisplayName { get; set; } public string ValueCode { get;...
13 Jan 2014 by Suk@nta
Change this public List SubCategories { get; set; }to public List SubCategories { get; set; }
2 Apr 2014 by A.Q.Ghouri
I have posted a question here, anybodu can help?http://stackoverflow.com/q/22833170/1147352[^]
16 Apr 2014 by ketan italiya
I have 4 tables ,Which are as per below.Table1a1(primarykey)a2a3................Table2b1...
16 Apr 2014 by DamithSL
if you want to group by column b2 only, then var p = from r in db.Table1 where r.a1 == Convert.ToInt32(Session["idforexcelpage"].ToString()) join a in db.Table2 on r.Table1 equals a.Table2 join b in db.Table3 on a.Table2 equals b.Table3 join e in db.Table4...
10 May 2014 by GoodFellas22
Hi guys,i have a List that contains elements of type "S1-00-1001" "S1-00-1002" and so on up to "S1-00-1200" consecutive, then other element "S1-00-1501" "S1-00-1502" and so on up to "S1-00-1600" consecutive and many other elements.In general i want that my output would be...
12 May 2014 by GoodFellas22
hi guys,i think i've solved my problem this way:List series = new List();series = FindSeries(consecutive);consecutive is the list with items like the first examplewith the method:public List FindSeries(List list) { ...
19 Oct 2015 by Maciej Los
Another solution:DECLARE @tmp TABLE(ID INT, [Name] VARCHAR(30), [Year] INT)INSERT INTO @tmp (ID, [Name], [Year])VALUES(1, 'Arun', 2001),(2, 'Arun', 2002),(3, 'Arun', 2003),(4, 'Arun', 2004),(5, 'Arun', 2009),(6, 'Arun', 2010),(7, 'Arun', 2011),(8, 'Bala', 2014),(9,...
17 May 2016 by MKM_Matt
Hi. I am trying to map the following XML
24 May 2016 by MKM_Matt
XML is:
22 Dec 2016 by User 12632236
Hi,I am facing a problem with dynamic grouping.I have a requirement where buttons are draggable for grouping for generating reportI tried using dynamic linq.I don't want to use magical string.So I decided to take more time and get something without using strings.I found C# 6.0 in...
22 Dec 2016 by Maciej Los
Please, check this: Linq GroupByMany dynamically – Mitsu's blog[^]
10 Nov 2017 by Member 9983063
Hello, Guys am working on c# and am facing an issue. "Additional information: Your query does not include the specified expression 'Item Name' as part of an aggregate function." I don't know and I have tried many things but this error still there please help and tell me what is this and how can...
10 Nov 2017 by Suvendu Shekhar Giri
You need to include the list of columns in the GROUP BY clause which are available in the SELECT list and doesn't associated with an aggregate function. Your query should look like- SELECT sum(Column1) As [Item Price],[column2]As [Item Name],[column3]As [Table Name],[Flavours],[Customer...
30 Dec 2017 by Rain Alex
I have a problem and I'm not to sure about how to go about handling it. I have a group a students in a school management database that I need to randomly assign to pre-defined groups. I've done a lot of research on group assignment but I can't quite find what I'm looking for. Basically, a...
16 Feb 2021 by RickZeeland
CREATE TABLE Donor ([id] bigint, [amount] float, [city] varchar(50)); INSERT INTO Donor ([id], [amount], [city]) VALUES (1, 1.0, 'New York'), (2, 4.5, 'Washington'), (3, 4.5, 'Washington'), (4, 4.5, 'Washington'), (5, 10.3,...
10 Apr 2021 by Muhammad Ismail Bangulzai
Hi I want to display 2 Copies of same report in single page. the problem is (in details section it could be multiple records and I am using group to categorize my data). What I have tried: I created a formula and added this in report footer...
15 Dec 2021 by Member 10252017
DataTable1 columnName colGroup ----------------- --------------- OriginCompany YES OriginAddress YES OriginZip OK OriginState NO DataTable2 OriginCompany OriginAddress OriginZip OriginState ------------ ...
14 Dec 2021 by Gerry Schmitz
Maybe not the most efficient, but with few columns, shouldn't make much difference. asp.net - Remove columns from DataTable in C# - Stack Overflow[^] So, remove any "not" in the selected list of columns.
15 Dec 2021 by George Swan
It seems to me that working with DataTables is not easy as lots of casting is needed in order to extract anything more meaningful than an object from them. I would do something like this to get the required column names from table1. ...
19 Feb 2022 by Manish A
Main Table: Date_And_Time Date Time Tags Value A B C 2022-02-08 06:01 2022-02-08 06:01 A01.B04.C_01 1 A01 B04 C_01 2022-02-08 06:01 2022-02-08 06:01 A01.B04.C_02 2 A01 B04 C_02 2022-02-08...
29 Mar 2022 by Member 15502485
I want to split each into parts after grouping values of CC and Att found in I am able to achieve it to some extent , but not in a consistent way. With some data is...
28 May 2015 by Robert.Verpalen
DataGridViewGrouper: add grouping functionality to the .NET DataGridView
6 Dec 2013 by dabbourabd
Hi every one I wrote program in c# get details about files to compare them laterI have Listview control with 6 columnI an using the following code to add items to listviewbut I need to group items according to column 6 valuesvar items = from f in Files_pathes_hash_Dup ...
9 Aug 2012 by Tbone1983
You could use this to resolve the problem: var prodlist = Db.Details.GroupBy(x=>new {x.ProdCode}).Select(x=>new Product(){ ProdCode = Convert.ToInt32(x.FirstOrDefault().ProdCode), NetAmount = x.Sum(s => s.Amount), BillDetailIds = Db.Details.Where( ...
11 Oct 2013 by ASP.NET Community
While answering forums I come across a post “Grouping the data in the data table” which lead me to write this short code snippet for that post. 
25 Jun 2014 by sirol81
Case 1 works fine, but how can I make case 2 work?It won't build on Key.A or Key.BIEnumerable> result = null; Func predicate = null; switch (fields.Length) { case 2: result...
30 May 2012 by skadukuntla
Can i get code for Gridview Grouping, Gridview subtotal, Gridview Total
12 Apr 2021 by Member 15145141
I have encountered this as challenge lately and I solved it using lead windows function just order the result by year and find the lead and the next lead then eliminate null values at last in the where conditions check for sequence rule. I think...
10 Apr 2021 by Ragul M
I have a event table in which the list of user participated will be stored.Sample Data:╔════╦══════╦══════╗║ id ║ name ║ year ║╠════╬══════╬══════╣║ 1 ║ Arun ║ 2001 ║║ 2 ║ Arun ║ 2002 ║║ 3 ║ Arun ║ 2003 ║║ 4 ║ Arun ║ 2004 ║║ 5 ║ Arun ║ 2009 ║║ 6 ║ Arun ║ 2010...
19 Nov 2012 by leoiser
Hi. I have an issue with RDLC to geneate the below report. I have 3 tables. and I want to display the report like the below (group by VendorID). How to do this. Please help me on this. Thanks tblCompany tblVendor tblOrders ebinroyebinroy0 Points4...