c# - ASP MVC 4, passing data in custom editor template -


i'm using line of code call custom editor template.

@html.editor("country", "customdropdown", countryselectionlist) 

i'd access countryselectionlist in customdropdown view , iterate on items: how can that? countryselectionlist of type selectlist.

this tried in view:

@model selectlist  @foreach (var item in model.items) {     <div>@item.tostring()</div> } 

but got object reference not set instance of object error.

so how can that? i'd own dropdown list: impossible without iterating on key + value pairs of selectlist.

@html.partial("~/views/shared/editortemplates/customdropdown.cshtml", customercountryselectionlist) 

and models goes straight view.

@html.editor(), despite having 6 overloads, have none of them designed pass model inside custom editor.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -