asp.net mvc 4 - Passing data from a controller to a view (MVC) -


I'm having a small problem where I can not send the data to the view.

I have the controller ViewBag.InvalidParts = invalid;

I have this view

  & lt; H2 & gt; @ html.DisplayText ("InvalidParts") & lt; / H2 & gt;   

I get this error on my web page:

System. Selection. Generic List 1 [System.String]

When I step through my code I see that 20 records are stored in my visual bag, my problem is that I can not see them. Am I making the wrong call? Thanks in advance for help

In your foreach, you need to use defined variables. In this situation, I do not think you need Assistant to try changing your code

  @foreach (ViewBag.InvalidParts in varB invalid) {& lt; Text & gt; & Lt; H2 & gt; @ Invalid & lt; / H2 & gt; & Lt; / Text & gt; }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -