0

I am using model in my _Layout.cshtml file:

@model PagedList.IPagedList<DluzynaSzkola.Models.Aktualnosci>

and using the model for iteration to post data from Aktualnosci database:

@foreach (var item in Model)
{
    <div>@Html.DisplayFor(modelItem => item.Dzien)</div>
} 

Whenk moving to site, where layout page is used, and there is definded another model:

@model DluzynaSzkola.Models.User

it is throwing me System.NullReferenceException with error source exception:

Wiersz 112: @foreach (var item in Model)

Why I can not use twice @model in one page? and how can I deal with that?

bakunet
  • 11
  • 1

0 Answers0