Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'SelectedClientList'.

$
0
0
hi guys,

I have developed a MVC implementation 5, it works perfectly locally
but I published it on IIS and I have had this problem
//

in the controller I

public ActionResult Index ()
         {
             CatalogModel m = new CatalogModel ();
             m.LocalCodeColumn = 1;
             m.PriceColumn = 2;
             m.SelectedClientList = m.GetClientSelectedItems ();
             return View (m);
         }


and in the view:

Select Client: @ Html.DropDownListFor (m => m.SelectedClientList, Model.GetClientSelectedItems (), "--Select--", new {@id = "ddlClient"})
and this function :

public IEnumerable<SelectListItem> GetClientSelectedItems()
        {
            // Function GetListClient() return IEnumerable<SelectListItem> 
            IEnumerable<SelectListItem> listClient = dataServices.GetClients();
            return listClient;
        }

Viewing all articles
Browse latest Browse all 3938


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>