I have a check box list in that user can check or uncheck the check box.
Based on the selected check box I used to store that value by comma separated. Now the problem is based on selected check box I need to get that particular column alone. in "select"**
db.Tasks.OrderBy(t => t.CreatedDate).ToList()
.Select(t => new {
Id = t.Id,
PriorityId = t.ProjectId,
Priority = t.Priority,
StatusId = t.StatusId,
Status = t.Status,
EstimatedTime = t.EstimatedTime,
ActualTime = t.ActualTime,
Subject = t.Subject,
FileName = t.FileName,
AssignedTo = t.AssignedTo,
Project = t.Project
}).ToList();
if i select in check box list ActualTime, Subject, it should be like
db.Tasks.OrderBy(t => t.CreatedDate).ToList()
.Select(t => new {
Id = t.Id,
ActualTime = t.ActualTime,
Subject = t.Subject
}).ToList();
if i select in check box list Subject, FileName, AssignedTo, it should be like
db.Tasks.OrderBy(t => t.CreatedDate).ToList()
.Select(t => new {
Id = t.Id,
Subject = t.Subject,
FileName = t.FileName,
AssignedTo = t.AssignedTo
}).ToList();
the select will be dynamic based on selected check box list.