<p>I had a working solution using ASP.NET MVC Preview 3 (was upgraded from a Preview 2 solution) that uses an untyped ViewMasterPage like so:</p>

<pre><code>public partial class Home : ViewMasterPage
</code></pre>

<p>On Home.Master there is a display statement like this:</p>

<pre><code>&lt;%= ((GenericViewData)ViewData["Generic"]).Skin %&gt;
</code></pre>

<p>However, a developer on the team just changed the assembly references to Preview 4.</p>

<p>Following this, the code will no longer populate ViewData with indexed values like the above.</p>

<p>Instead, ViewData["Generic"] is null.</p>

<p>As per <a href="https://stackoverflow.com/questions/18787/aspnet-mvc-user-control-viewdata">this question</a>, ViewData.Eval("Generic") works, and ViewData.Model is also populated correctly.</p>

<p>However, the reason this solution isn't using typed pages etc. is because it is kind of a legacy solution.  As such, it is impractical to go through this fairly large solution and update all .aspx pages (especially as the compiler doesn't detect this sort of stuff).</p>

<p>I have tried reverting the assemblies by removing the reference and then adding a reference to the Preview 3 assembly in the 'bin' folder of the project. This did not change anything.  I have even tried reverting the Project file to an earlier version and that still did not seem to fix the problem.</p>

<p>I have other solutions using the same technique that continue to work.</p>

<p>Is there anything you can suggest as to why this has suddenly stopped working and how I might go about fixing it (any hint in the right direction would be appreciated)?</p>

[{'answer_id': 61808, 'author': 'Matt Mitchell', 'author_id': 364, 'author_profile': 'https://Stackoverflow.com/users/364', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ve decided to replace all instances of ViewData["blah"] with ViewData.Eval("blah").\nHowever, I\'d like to know the cause of this change if possible because:</p>\n\n<ol>\n<li>If it happens on my other projects it\'d be nice to be able to fix.</li>\n<li>It would be nice to leave the deployed working code and not overwrite with these changes.</li>\n<li>It would be nice to know that nothing else has changed that I haven\'t noticed.</li>\n</ol>\n'}, {'answer_id': 61835, 'author': 'Ricky', 'author_id': 653, 'author_profile': 'https://Stackoverflow.com/users/653', 'pm_score': 0, 'selected': False, 'text': '<p>How are you setting the viewdata? This works for me:</p>\n\n<p>Controller:</p>\n\n<pre><code>ViewData["CategoryName"] = a.Name;\n</code></pre>\n\n<p>View:</p>\n\n<pre><code>&lt;%= ViewData["CategoryName"] %&gt;\n</code></pre>\n\n<p>BTW, I am on Preview 5 now. But this has worked on 3 and 4...</p>\n'}, {'answer_id': 61846, 'author': 'Matt Mitchell', 'author_id': 364, 'author_profile': 'https://Stackoverflow.com/users/364', 'pm_score': 0, 'selected': False, 'text': '<p>Re: Ricky</p>\n\n<p>I am just passing an object when I call the View() method from the Controller.</p>\n\n<p>I\'ve also noticed that on my deployed server where nothing has been updated, ViewData.Eval fails and ViewData["index"] works.</p>\n\n<p>On my development server ViewData["index"] fails and ViewData.Eval works...</p>\n'}, {'answer_id': 63293, 'author': 'Ricky', 'author_id': 653, 'author_profile': 'https://Stackoverflow.com/users/653', 'pm_score': 0, 'selected': False, 'text': "<p>Yeah, so whatever you pass into the View is accessible in the View as ViewData.Model. But that will be just a good old object if you don't do the strongly typed Views...</p>\n"}, {'answer_id': 93938, 'author': 'Haacked', 'author_id': 598, 'author_profile': 'https://Stackoverflow.com/users/598', 'pm_score': 2, 'selected': True, 'text': '<p>We made that change because we wanted a bit of symmetry with the [] indexer. The Eval() method uses reflection and looks into the model to retrieve values. The indexer only looks at items directly added to the dictionary.</p>\n'}]
['https://Stackoverflow.com/questions/61805', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/364/']