Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:20:33+00:00 2026-06-06T13:20:33+00:00

I have a check box list in that user can check or uncheck the

  • 0

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();

enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:20:35+00:00Added an answer on June 6, 2026 at 1:20 pm

    add DynamicLibrary.cs to your project.
    You can get it from this link . It’s a zip file that contains the dynamic link source. It’s not a dll.
    Originally posted on ScottGu’s blog here.
    for reference see this stack overflow link .

        using System.Linq.Dynamic;
    
        public class DynamicColumns : BaseEntity
        {
            public string User { get; set; }
            public string TaskId { get; set; }
            public string Project { get; set; }
            public string Priority { get; set; }
            public string TaskType { get; set; }
            public string Version { get; set; }
            public string Module { get; set; }
            public string Subject { get; set; }
            public string Details { get; set; }
            public string FileName { get; set; }
            public string Status { get; set; }          
            public string AssignedBy { get; set; }
            public string AssignedTo { get; set; }
            public int ActualTime { get; set; }
            public int LogWork { get; set; }
            public DateTime CreatedDate { get; set; }
            public DateTime AssignedDate { get; set; }
            public DateTime ResolveDate { get; set; }
            public int EstimatedTime { get; set; }
        }
    
        public enum EnumTasks
        {
    
            User = 1,
            Project = 2,
            Priority = 3,
            TaskType = 4,
            Version = 5,
            Module = 6,
            Subject = 7,
            Details = 8,          
            Status = 9,            
            Assigned_By = 10,
            Assigned_To = 11,
            Created_Date = 12,
            Assigned_Date = 13,
            Resolve_Date = 14,
            Estimated_Time = 15,
            Actual_Time = 16,
            LogWork = 17
        }
    
        public IQueryable DynamicSelectionColumns()
        {
            using (var db = new TrackerDataContext())
            {
                string fieldIds = "," + "4,5,3,2,6,17,11,12" + ",";
    
                var taskColum = Enum.GetValues(typeof(EnumTasks)).Cast<EnumTasks>().Where(e => fieldIds.Contains("," + ((int)e).ToString() + ",")).Select(e => e.ToString().Replace("_", ""));
    
                string select = "new (  TaskId, " + (taskColum.Count() > 0 ? string.Join(", ", taskColum) + ", " : "") + "Id )";
    
                return db.Task.ToList().Select(t => new DynamicColumns() { Id = t.Id, TaskId = Project != null ? Project.Alias + "-" + t.Id : t.Id.ToString(), ActualTime = t.ActualTime, AssignedBy = t.AssignedBy.ToString(), AssignedDate = t.AssignedDate, AssignedTo = t.AssignedTo.ToString(), CreatedDate = t.CreatedDate, Details = t.Details, EstimatedTime = t.EstimatedTime, FileName = t.FileName, LogWork = t.LogWork, Module = t.Module != null ? t.Module.Name : "", Priority = t.Priority != null ? t.Priority.Name : "", Project = t.Project != null ? t.Project.Name : "", ResolveDate = t.ResolveDate, Status = t.Status != null ? t.Status.Name : "", Subject = t.Subject, TaskType = t.TaskType != null ? t.TaskType.Type : "", Version = t.Version != null ? t.Version.Name : "" }).ToList().AsQueryable().Select(select);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have list of product.That list contain check-box & qty in Text-box.IF the user
I have a situation where a user can click a check box field, field_enable,
I have a loop that generates List of items with Check box to select
I have a list of options on my site that a user can select.
Imagine the following scenario. I have a checkbox that the user can check to
I have a form where a user can toggle receiving funds either via check
I have a list box with a list of strings. Based on the string
I have a list of checkboxes that the user uses to show and hide
I have a checkbox list that each time the user selects one item, my
I'm trying to make a to do list that you can check off completed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.