Q: Enter data in a view using the dynamic model In view I want display data from list ucz and insert data to listaOcen. display the list of ucz works but I have no idea to input data into list listaOcen
@using biblioteka;
@model dynamic

    <tr>

@for (int i = 0; i < Model.dl;i++ )
{

   td>@Model.Uczniowie[i]</td>
<td>
@Html.DropDownList(Model.listaOcen[i], new[] { //doesnt work
       new SelectListItem() { Text = "5", Value = "5" },
       new SelectListItem() { Text = "4+", Value = "4.75" },

}, "Select option")
<td>
</tr>
}

Controller:
        public ActionResult Add(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var dataContext = db.Uczniowie;
            var ucz = dataContext.Where(m => m.KlasaId == id)
                                 .Select(m => m.Nazwisko + " " + m.Imie);


            List<double> listOfOcena = new List<double>();
            dynamic mymodel = new ExpandoObject();
            mymodel.Uczniowie = ucz.ToList();
            mymodel.dl = ucz.ToList().Count;
            mymodel.listaOcen = listOfOcena;// enter the data from DropDownLists
            return View(mymodel);

It is model. 
public  class Ocena
    {         
        public string IdUcznia { get; set; }
        public string Id { get; set; }
        public string Przedmiot { get; set; }           
        public double Wartosc { get; set; }
        public double waga { get; set; }
        public DateTime? Data { get; set; }
        public string Rodzaj { get; set; }
        public string Opis { get; set; }

    }   

Please help :) 

A: Robert, first of all try to avoid dynamic model. Create a viemodel for your action. e.g.
    public class StudentMarkAssignViewModel
    {
        public long StudentId { get; set; }

        public string FullName { get; set; }

        public double Mark { get; set; }
    }

then fill it in your action
        [HttpGet]
    public ActionResult Add(string id)
    {
        var model = new StudentMarkAssignViewModel[]
        {
            new StudentMarkAssignViewModel {StudentId = 1, FullName = "Martin", Mark = 0 },
            new StudentMarkAssignViewModel {StudentId = 2, FullName = "Robert", Mark = 5 }
        };
        //here i use hardcoded valuse, but you should get them from your db
        return View(model);
    }

after that you can render list of your students and assign them marks and submit it to the server
@using WebApplication100.Models

@model StudentMarkAssignViewModel[]

@using (Html.BeginForm("Add", "StudentMarks", FormMethod.Post))
{
    <table>
        @for (var index = 0; index < Model.Length; index++)
        {
            <tr>
                @Html.HiddenFor(x => Model[index].StudentId)
                @Html.HiddenFor(x => Model[index].FullName)
                <td>@Model[index].FullName</td>
                <td>
                    @Html.DropDownListFor(x => Model[index].Mark, new SelectListItem[]{
                        new SelectListItem{ Value = "0", Text = "Not Rated", Selected = Model[index].Mark == 0  } ,
                        new SelectListItem{ Value = "5", Text = "5"  , Selected = Model[index].Mark == 5  } ,
                        new SelectListItem{ Value = "4.75", Text = "4+"  , Selected = Model[index].Mark == 4.75  }
               })
                </td>
            </tr>
        }
    </table>

    <button type="submit">submit</button>
}

after you submit the form, you'll get list of students and their marks on the server
    [HttpPost]
    public ActionResult Add(StudentMarkAssignViewModel[] marksModel)
    {
        /* do whatever you need with your model*/
        return RedirectToAction("Index");
    }

that's all. I hope you'll get the point.
