asp.net mvc - How do I display data in a Repeater using Entity Data Model and MVC -


I'm trying to follow this example:.
When I try this, I get an error:

  View Data.model = _db.MovieSet.ToList ();  

In my intellisense, I have not received ToList ()

Here is the code:

  using System.Linq; Using System.Web.Mvc; Using MovieEntityApp.Models; Nomination Movie EntityApp.Controllers {[HandleError] Public Class Home Controller: Controller {FilmsBoots _DB; Public Home Controller () {_db = New movies DBETTA (); } Public Performance Index () {ViewData.Model = _db.MovieSet.ToList (); See Return (); }}}  

I am trying to display the results in the view of repeater, anyone will see that code as well as the code of the ASPX page.

Repeater is designed for web forms and works with web form events. In MVC, you really want to avoid data-bound controls such as repeater, gridwew, listviewview. It is very easy to spit films in the loop, though:

   & Lt; TR & gt; & Lt; TD & gt; & Lt;% = Html.Encode (item.Title)% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = HTML.Encode (item.ReleaseDate.Year)% & gt; & Lt; / TD & gt; ... & lt; / Tr & gt; & Lt;%}% & gt;  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -