New to ASP.NET MVC (now using MVC3 with Razor), and I'm confused about passing an object from a controller to a view. In particular, I am experimenting with MVC3 and Rob Conery interesting Massive (http://blog.wekeroad.com/helpy-stuff/and-i-shall-call-it-massive). I use the blog as a simple web application for experimentation.
HomeController.cs:
public ActionResult Index() { var table = new DynamicModel("mydb", tableName: "Posts");
This part works great. But how do I do this?
return View(posts);
If I refer to @posts.PostID in the view, it throws an error and says that it is invalid. So I tried to create a strongly typed view against DynamicModel, but there were still no posts .
I know that I can create a ViewModel and print a view against this and connect my data there. This is more about how to interact Controller / View.
Thanks!
c # asp.net-mvc asp.net-mvc-3
Nathan loding
source share