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
sonal malhotra
NA
410
51.8k
i have issue Another Include() method in mvc
Feb 27 2019 4:02 AM
hello everyone,
first i clicked on index razor , it display list of category Electronic n so on ... Error server shown below
first model
public
partial
class
categoryTable
{
public
int
CategoryId {
get
;
set
; }
public
string
CategoryName {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
virtual
List<Itemtable> Itemtables {
get
;
set
; }
}
controller
public
ActionResult Index()
{
var ctx =
new
shop_cartEntities();
var category1 = ctx.categoryTables.ToList();
return
View(category1);
}
public
ActionResult Browser(
string
category)
{
shop_cartEntities ctx =
new
shop_cartEntities();
var categorymodel = ctx.categoryTables.Include(c=>c.Itemtables).Single(c => c.CategoryName == category);
return
View(categorymodel);
Server Error in '/' Application.
A specified Include path is not valid. The EntityType 'shop_cartModel.categoryTable' does not declare a navigation property with the name 'Itemtables'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: A specified Include path is not valid. The EntityType 'shop_cartModel.categoryTable' does not declare a navigation property with the name 'Itemtables'.
please help me where i have wrong in include method
Reply
Answers (
3
)
how to find the database name from code ?
how to connect to fetech data to pie chart?