Hi Experts,
I want to remove all duplicate rows from datagrid automatically.Can anyone please help me to do this.
Thanking you
Bunty
Answer: 1
you can do it in your binding data before you assign it to your control. with checking the unique field value
Answer: 2
hi BuntyBubly
Are u writing on the cells of the datagrid after binding data to the DataGrid ??????
Answer: 3
No ,My datagrid is loading from the List<>.So where I have to check the duplicacy and how can i eliminate it?
Answer: 4
hi BuntyBubly you can follow the below code
DomainService1 ds = new DomainService1();
ds.Load(ds.GetMST_CDS_ProblemQuery(), LoadBehavior.RefreshCurrent, k =>
{
List<MST_CDS_Problem> nmr = k.Entities.ToList();
nmr.Distinct();
}, null);
Thanks & Regards
Mastan Narravula
Mark as Answer", if it helped you or it might help others too.
Answer: 5
Hi Bunty,
Try this:
List<String> list = new List<string>(); list.Add("MarkMe"); list.Add("MarkMe?"); list.Add("MarkMe"); list.Add("UnMarkMe"); list.Add("UnMarkMe?"); list.Add("MarkMe!"); dataGrid1.ItemsSource = list.Distinct(); List provide an method Distinct(), (actually it is IEnumerable<T>.Distinct<T>() ).
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog