asp.net - ASP .NET MVC CSHTML - DropDownList -


im trying retrieve data localdb in cshtml file this:

@html.labelfor(model => model.tipocliente, "tipo cliente", new { @class = "control-label col-md-2" })         <div class="col-md-10">             @{list<selectlistitem> listitems = new list<selectlistitem>();               foreach (var item in model.tipoclientenamespace.tipoclientevalor)               {                   listitems.add(new selectlistitem                   {                       text =(string) item.descricao                   });               }}             @html.dropdownlist("tipo cliente", listitems,  new { @class = "form-control" })              @html.validationmessagefor(model => model.tipocliente)         </div> 

but error "object reference not set instance of object." on line

foreach (var item in model.tipoclientenamespace.tipoclientevalor) 

anyone can me?


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -