I am currently using MVC4, and from a layout
I am calling a PartialView
:
@Html.Partial("~/Views/PartialView/EditForm.cshtml")
And when I run the application for the first time I get this error:
With the application URL in the following way:
localhost:50234
Then, I run the application again and it works without errors of null
. But change the URL:
http://localhost:50234/PartialView/EditForm
The elements that generate conflicts are elements defined in viewmodel
as "catalogos"
public IEnumerable<String> Catalogo1 { get; set; }
public IEnumerable<String> Catalogo2 { get; set; }
public IEnumerable<String> Catalogo3 { get; set; }
public IEnumerable<String> Catalogo4 { get; set; }
My question is:
- The error is found in the call to
PartialView
(considering it is aviewmodel
)? Should I make the call in another way? - The catalog elements created in
viewmodel
should go with "get" "set" or should they be initialized in another way? - Is there a way to go directly to the URL of
ActionResult
on the first run?