hi,
i am getting error after post, when i am using dropdown in my mvc website, the code is as follows
ViewData["JobSite_JobCategories1"] = new SelectList(context.JobSite_JobCategories, "Id", "Category", null);
<%= Html.DropDownList("JobCategory", ((IEnumerable<SelectListItem>)ViewData["JobSite_JobCategories1"]))%>
<%= Html.ValidationMessageFor(model => model.JobCategory) %>
The validation is not working, and also after i catch error i fill the viewdata["JobSite_JobCategories1"] with selectlist again but still, it gives error
There is no ViewData item of type 'IEnumerable' that has the key 'JobCategory'.
Please can any one suggest me the solution to this problem, any articles, samples, links.