error: There is no ViewData item of type 'IEnumerable' that has the key 'AppCurrentLanguage'.
Model:
public class HomeIndexView
{
public IList TileList { get; set; }
public string InfoMessage { get; set; }
public HomeIndexView()
{
TileList = new List();
}
public List LanguageList { get; set; }
public string AppCurrentLanguage { get; set; }
}
view:
@Html.DropDownListFor(model => model.AppCurrentLanguage, Model.LanguageList, new { id="appLanguage", name="appLanguage", tabindex = "0" })
controller:
public ActionResult GetLanguage()
{
HomeIndexView model = new HomeIndexView
{
LanguageList = this.RetrieveLanguagesList(),
};
//return PartialView("ViewsList", model);
return View(model);
}
public List<SelectListItem> RetrieveLanguagesList()
{
var list = new List<SelectListItem>();
var sourceOfCallList = uow.AppLanguage.GetAll().ToList();
if (sourceOfCallList != null)
{
foreach (var type in sourceOfCallList)
{
//list.Add(type.LanguageName+"-"+type.LanguageCode);
list.Add(new SelectListItem { Text = type.LanguageName, Value = type.LanguageCode });
}
}
return list;
}
this.RetrieveLanguagesList()
怎麼寫的
AppCurrentLanguage也沒有帶上值