Hi, I'm facing the following problem: in the controller I select the data I need and store it into the ViewData;
using (Models.SkedruleEntities ctx = new Models.SkedruleEntities())
{
ViewData["users"] = (from u in ctx.User select u);
}
In the View I try to read from the ViewData like this:
<p>
<%foreach(User user in (IEnumerable<User>)ViewData["users"]) { %>
<div><%=user.Name %></div>
<%}%>
</p>
But I get a System.ObjectDisposedException
error, as the ViewData seems to contain the query, not the data retrieved by the query and of course the context ctx is no more available.
Any help? Thanks