mvc user control problem foreach loop mvc user control problem foreach loop

Previous post

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>  <%     MvcApplication1.Models.FeaturesRepository _model = new MvcApplication1.Models.FeaturesRepository(); %>  <% foreach (var md in _model.GetAllFeatures())    { %>        <li><%= md.vcr_FeaturesName  %></li>  <% } %> 

It is with reference to the previous post above.Is there something wrong with the foreach loop(The result is correct but it is displaying the series of Add,Add,Add,Add,Add,Add...,which is the last record of the getallfeatures.

Should I dive into ASP.NET MVC or start with ASP.NET Webforms?


ASP.NET MVC Cookie loses value when page is changed
@mazhar, instead of creating your model like you are, in MVC you should return the model to the view..
Disable cache in Silverlight HttpWebRequest
In your controller you would say something like return View(MyModel);.
How do I display the duration it took to generate a page in a pages footer?
I don't see anything wrong, per-sey, with your foreach but if you are going to replicate a control over and over you may want to consider a PartialView and rendering that by passing the appropriate model to it..
Additional information in ASP.Net MVC View
<% foreach ( var md in model.features ) Html.RenderPartial(md); %> 
The above is untested but close I think..
Facebook IFrame Application issues for certain users
I haven't looked at the previous post because I think you need to get this into the MVC way first.

programmatically logout a “specific” user
I don't think there is technically anything incorrect in your code and suspect it's your controller and model code.. mvc html melper
I've edited your post to remove the commented out code.

Very confusing leaving it in..

75 out of 100 based on 60 user ratings 485 reviews