Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a controller with a class objects in Table1,:
C#
public ActionResult Index()
{
    private testContext db = new testContext();
    List<Table1> thetable = db.Data1.ToList();
    return View(thetable);
}

I want to show the contents of a List<table1> of a model with my class object in Tables in a view:
HTML
@model ????
Posted
Updated 24-Jan-15 20:47pm
v4
Comments
Zoltán Zörgő 25-Jan-15 2:51am    
List<Table1> ????? Is Table1 the POCO class for Data1 or what?
If so Enumerable<Table1> can be your model.
But I wouldn't call ToList. It is meaningless in this case.
Kornfeld Eliyahu Peter 25-Jan-15 3:16am    
What db.Data1 is? Why not use it as model?
teledexterus 25-Jan-15 4:13am    
I am having problems with "@model IEnumerable<myproject.models.table1>". <Tables> is common between thetable and db.Data1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900