Design a site like this with
Get started

There is no ViewData item of type ‘IEnumerable’ that has the key ‘DropDownList’.

Solution In Controller ViewData["DropDownList"] = clsChargesCollection.FillInstallments().Select(x => new SelectListItem { Text = x.Description, Value = x.ID.ToString() }).ToList(); Syntax ViewData["name to be given"]=db.MethodName.Select(object => new SelectListItem{Text = object.columnName, Value = object.columnName.ToString()}.ToList(); In View: Try to access the variable within the top of your View where titles are given @{ List <SelectListItem> MemIds = ViewData["DropDownlist"] as List<SelectListItem>;... Continue Reading →

System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page “~/Views/Shared/_Layout.cshtml”: “Scripts”.

Solution The exception occurs if you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View. If your _Layout.cshtml has something like this: @RenderSection("scripts") Then all your Views that use that Layout must include a @section with the same name (even if the contents of the section are... Continue Reading →

Blog at

Up ↑