I have a viewmodel defined as
public class linkVM
{
public AL.Common.Content.Object.PageIndex[] pages{ get; set; }
public string sPageId { get; set; }
}
In a strogly typed form I am using
<%Html.DropDownListFor(n => n.pages, new SelectList(Model.pages, “PageId”, “ShortName”, Model.sPageId ));%>
I get a compile error on the SelectList(Model.pages, portion which says
‘Model’ conflicts with the declaration ‘System.Web.Mvc.ViewPage.Model’
There is clearly a chunk of basic knowledge I am missing – can anyone enlighten me please
thanks
It should be:
Also make sure that your view is strongly typed to this
linkVMclass (the@Pagedirective at the top):Also the controller action that rendered this view needs to pass the correct model:
Also the convention in C# is to have class name and property names start with a Capital letter.