Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a datatable which contains say 4000 rows.. In this table there is a column "Name". What i want is that i want to show unique names in the data grid ... Is there any built in funcions for grid or do we have to do some coding to get the result??

Thanks in advance
Posted
Updated 17-Jul-13 20:59pm
v2

Try this

C#
DataTable __tbl - GetData();

Grd.DataSource = __tbl;

// TO FILTER DISTINCT NAME

DataView __dv = __tbl.DefaultView;

DataTable __tblFiltered = __dv.ToTable(true, "Name");

Grd.DataSource = __tblFiltered;
 
Share this answer
 
Comments
Arjun Menon U.K 18-Jul-13 3:39am    
this will group by name know... what i am trying to do is a grid view in which first column in Check box to select the rows, the second column the business name , then 8 other columns. i want to create a single cell for a business and it will have 8/10 rows for the remaining fileds... like this

http://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq#faq8


but am not getting any idea how to implement this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900