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 8808501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:38:22+00:00 2026-06-14T02:38:22+00:00

I created a list property in my model like so public virtual List<String> listOfDays

  • 0

I created a list property in my model like so

public virtual List<String> listOfDays { get; set; }

then I converted and stored it in the list like this:

for (int i = 0; i < 30 i++)
{
            var enrollment = new Enrollment();
            enrollment.StudentID = id;
            enrollment.listOfDays = searchString.ToList(); 
            db.Enrollments.Add(enrollment);
            db.SaveChanges();
}

I put a breakpoint here… enrollment.listOfDays = searchString.ToList(); … and all is well. I see that the conversion was performed and I can see the values in listOfDays.

So I thought I would find a column in my database called listOfDays since I’m doing code first but the property is not there.

Then I thought I’d try accessing it anyway like this…

var classdays = from e in db.Enrollments where e.StudentID == id select e.listOfDays;

var days = classdays.ToList(); 
//here I get an error message about this not being supported in Linq.

Questions:

  • Why do you think the property was not in the database?
  • How can I post this array to my model then access it in a controller?

Thanks for any help.

Thanks to Decker: http://forums.asp.net/members/Decker%20Dong%20-%20MSFT.aspx

Here’s how it works:

Using form collection here…

In [HttpPost]…

private void Update (FormCollection formCollection, int id)

for (int sc = 0; sc < theSelectedCourses.Count(); sc++)
{
var enrollment = new Enrollment();
enrollment.CourseID = Convert.ToInt32(theSelectedCourses[sc]);
enrollment.StudentID = id;
enrollment.listOfDays = formCollection[“searchString”] ;//bind this as a string instead of a list or array.

Then in [HttpGet]…

private void PopulateAssignedenrolledData(Student student, int id)
{

var dayList = from e in db.Enrollments where e.StudentID == id select e;

var days = dayList.ToList();
if (days.Count > 0)
{
string dl = days.FirstOrDefault().listOfDays;
string[] listofdays = dl.Split(‘,’);
ViewBag.classDay = listofdays.ToList();
}

  • 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-14T02:38:23+00:00Added an answer on June 14, 2026 at 2:38 am

    Thanks to Decker: http://forums.asp.net/members/Decker%20Dong%20-%20MSFT.aspx

    Here’s how it works:

    Using form collection here…

    In [HttpPost]…

    private void Update (FormCollection formCollection, int id)

    for (int sc = 0; sc < theSelectedCourses.Count(); sc++)
    {
    var enrollment = new Enrollment();
    enrollment.CourseID = Convert.ToInt32(theSelectedCourses[sc]);
    enrollment.StudentID = id;
    enrollment.listOfDays = formCollection[“searchString”] ;//bind this as a string instead of a list or array.

    Then in [HttpGet]…

    private void PopulateAssignedenrolledData(Student student, int id)
    {

    var dayList = from e in db.Enrollments where e.StudentID == id select e;

    var days = dayList.ToList();
    if (days.Count > 0)
    {
    string dl = days.FirstOrDefault().listOfDays;
    string[] listofdays = dl.Split(‘,’);
    ViewBag.classDay = listofdays.ToList();
    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a property list with the name propertys.plist. Then I wrote this: NSString
I have a cart model class that has a List property like so: public
I have a class: public class Car { public string Model {get;set;} public string
My model is a simple parent/child representation looking like this public class Parent {
My simplified domain model looks something like this: public abstract class Entity<IdK> { public
I have a mapped model with Nhibernate like this: public class A { public
I have the following view model: Public Class MyViewModel Public Property SelectedIDs As List(Of
I have a view model like so that is created from my validator. public
I have defined the following select list: <%= this.Select(Scope) .Options(Scopes.AllValues) // static property to
I have a custom class: public class Person { public String Name { get;

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.