I have a razor page, where the SomeList property of my page model is of type List<Blah>
, with the following:
@await Html.PartialAsync("_QueueTable", Model.SomeList)
I have a partial with the following:
@page
@model List<Blah>
When I hit my breakpoint, trying to access Model gives me a NullReferenceException.
If I inspect ViewData inside the Non-Public members of the ViewBag I see the Model I'm looking for.
How do I set this up properly so that I can simply reference Model in my partial so I can act on my list?
the problem was that I had an @page directive at the top of my partial
I tried to remove the directive when I created the partial, but VS gave me an error saying that it must be present.
I didn't give it another thought, until a co-worker finally pointed it out. I removed the directive, did a clean, did a build and I'm in business.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.