TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Harsh Jani
NA
34
53.7k
I want to solve the given error
Apr 15 2015 4:08 AM
Hi!
I am getting the following error. Can anyone help me solve this error? The code is: -
public class CategoryController : Controller
{
//
// GET: /Category/
ProductsDbEntities ctx;
public CategoryController()
{
ctx = new ProductsDbEntities();
}
public ActionResult Index()
{
try
{
var categoryList = ctx.Categories.ToList();
return View(categoryList);
}
catch (Exception ex)
{
throw ex;
}
}
The code for the View is: -
@model MvcSession.Models.CategoryDetails
@{
ViewBag.Title = "SearchProducts";
}
@using (Html.BeginForm())
{
@Html.EditorFor(cat => cat.CategoryId);
<input type="submit" value="Search" class="btn btn-default" />
}
I am getting the following error when I run the application :-
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MvcSession.EntityModel.Category]', but this dictionary requires a model item of type 'MvcSession.Models.CategoryDetails'.
Reply
Answers (
2
)
how to read hindi,english text from pdf file in asp.net C# ?
get primay key value