|Hey Guys...so trying to get my head around MVC
My Index for holiday page is linked to the model
Im trying to pull the value of Holidays remaining from the HList4DD (HolidayListForDropDown) which is coming from the HolidayList.cs page.
I can get it through...
@foreach (var item in Model.HList4DD)
@Html.DisplayFor(modelItem => item.PersonId)
@Html.DisplayFor(modelItem => item.HolidayDate)
@Html.DisplayFor(modelItem => item.Person.HolidaysRemaining)
Although this displays the holidays remaining for every holiday booked. So if 20 holidays is the limit (4 booked and 16 remaining) this will produce a list of the dates of holidays booked i.e 4 records stating which date is booked, but it will show the '16' holidays remaining 4 times as well.
Yes, this is because it is inside the for loop but I tried to display it on its own and it didnt work
@Html.DisplayFor(model => model.HList4DD.//what do i add here?
Also tried to add
Person person = new Person();
currentHolidaysRemaining = person.HolidaysRemaining;
to the HolidayList. cs then in the view do
@Html.DisplayFor(model => model.currentHolidaysRemaining)
but its not pulling across the correct value, just returning 0