none
Como Adicionar uma lista de nomes em outra View? RRS feed

  • Pergunta

  • <divclass="form-group">@Html.LabelFor(model => model.CategoriaId, htmlAttributes: new { @class ="control-label col-md-2" })             <divclass="col-md-10">@Html.DropDownListFor(model => model.Categoria, newSelectList(Model.Categoria.Nome), "Sem categoria"new { @class ="form-control" })                 @Html.ValidationMessageFor(model => model.Categoria.Nome, ""new { @class ="text-danger" })             </div></div>

    System.NullReferenceException
      HResult=0x80004003
      Message=Referência de objeto não definida para uma instância de um objeto.
      Source=App_Web_iikt0c0u
      StackTrace:
       em ASP._Page_Views_CadastroFornecedor_Create_cshtml.Execute() em C:\Users\Anatole\Desktop\Projeto\ProjetoWebCadastro\ProjetoWebCadastro\Views\CadastroFornecedor\Create.cshtml:linha 99
       em System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       em System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       em System.Web.WebPages.StartPage.RunPage()
       em System.Web.WebPages.StartPage.ExecutePageHierarchy()
       em System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       em System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
       em System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
       em System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       em System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
       em System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       em System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)

                                                 
    domingo, 7 de julho de 2019 20:48