I want to use an ExpandoObject as the viewmodel for a Razor view of type ViewPage. I get an error when I do this
ViewPage
ExpandoObject o
Try setting the type as dynamic
dynamic
dynamic o = new ExpandoObject(); o.stuff = new { Foo = "bar" }; return View(o);
Go through this excellent post on ExpandoObject