Templist.ForEach(o => { var isSel = ReviewerFileRelationService.Where(s => s.PackageFileId == o.Id && s.ReviewerId == o.ContactId).AsQueryable().FirstOrDefault(); if (isSel != null) { o.Contact = "<input type="checkbox" checked onchange='set(this)' class="chk" id="" + o.Id + "_" + o.ContactId + "" /><label for="" + o.Id + "_" + o.ContactId + "" >" + o.UserName + "</label> "; } else { o.Contact = "<input type="checkbox" onchange='set(this)' class="chk" id="" + o.Id + "_" + o.ContactId + "" /><label for="" + o.Id + "_" + o.ContactId + "" >" + o.UserName + "</label> "; } });