Monday 15 September 2014

c# - Get distinct rows in Gridview based on One column -


Hello I'm trying to force a gridview with different rows from DB. I want to be deployed on the jabbed column. Please help

 using  (at ATPDataContext = new ATPDataContext ()) {var qryPartnerJobs at.jobs = (PJ to JQ at pj.JobID joining at.job_quotes Jq.JobID is equal to joining u in jq.TradeUserID is equal to at.users u.UserID where pj.IsApproved == true selection new {JobID = pj.JobID, FirstName = u.FirstName, ServiceName = pj.service.ServiceName, ServiceTypeName = pj.service_type.ServiceTypeName, IsApproved = pj.IsApproved, IsActive = pj.IsActive, IsQuoted = pj.IsQuoted, IsAssigned = pj.IsAssigned, ApprovalDate = pj.ApprovalDate, Description = pj Description}) Separate () .; GvPartnerJob.DataSource = qryPartnerJobs; GvPartnerJob.DataBind (); }    

different a accepts EqualityComparer & Lt; T & gt; As this parameter is, you can apply the requested functionality using the given comparer below:

  Public Class JobComparer: EqualityComparer & LT; Jobs & gt; {Public Override Bull Aiks (Job X, Job) • Return x.JobID == y.JobID; } Public override integer GetHashCode (job obj) {obj.JobID.GetHashCode return (); }}   

With this comparison, just use different (new job compairer)) on your collection.

No comments:

Post a Comment