This is a migrated thread and some comments may be shown as answers.

How to count the number of column which have unique values.

1 Answer 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Uttam Dhakal
Top achievements
Rank 1
Uttam Dhakal asked on 09 Nov 2012, 05:16 PM
I have a column named OrgName.
I am trying to get the numbers or Rows that have unique ORGNAME.
if there are two rows which have orgNamr= "Mac" then it should count as 1. so only the UNique columns.

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Nov 2012, 03:58 AM
Hello,

   int total = (from item in RadGrid1.MasterTableView.Items.Cast<GridDataItem>()
                                     select Convert.ToString(item["orgNamr"].Text)).Distinct().Count();
 
// 'orgNamr' is your column uniquename


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Uttam Dhakal
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or