Working against the current RC2 - the template that is generated Razor views includes:
@{ ViewBag.Title = "Details1"; Layout = "/Views/Shared/_Public.cshtml"; }
With a red squiggly under ViewBag.Title and this compiler error:'
Error 4 One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll? c:\Visual Studio 2010\Projects\myProj\Views\Webinar\Details1.cshtml 6 2 TTSTrain.Webinars.WebEntry
But the project builds and functions correctly. Is the error indicative of other problems that should be addressed?
ViewBag is a property – considered a dynamic object – that enables you to share values dynamically between the controller and view within ASP.NET MVC applications.
A Viewbag (also Viewdata, Viewbag is only a wrapper around Viewdata) can be used like a bucket for your data. But this is not nice and it's harming the Mvc-Pattern! The view knows its model and should not get any data from anything else.
I got the same problem after I removed the targetFramework
attribute from the <compilation>
element in the Web.config file.
Once I restored it to
<compilation debug="true" targetFramework="4.0">
Everything worked fine again!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With