rjcox:Do you have a code sample?
Both ViewPage and Controller have ViewData properties that should take precedence over the type (which I had not noticed for this reason).
(Since I'm generally using ViewPage<>... I'm not actually using Controller.ViewData anyway.)
I'll post some sample code later tonight after when I have access to that machine again. Do you mean that using ViewPage<T> changes the way to access the ViewData? I'll create some pseudo-code, which will represent what I am doing (typing without editor, please excuse the rough snippets).
Model
public List GetFoo(id)
{
return Foos.Where(f => f.ID == id).ToList();
}
Controller
public class FooController : Controllers
{
[ControllerAction]
public void Index(int id)
{
genericDataContext dc = new GenericDataContext();
var fooList = GetFoos(id);
RenderView("Index", fooList);
}
}
View
public partial class Index : ViewPage< List<Foo> >
{
}
Now, if I try to do something like:
foreach (Foo f in ViewData)
{
string s = f.Bar;
}
(tried in both code-behind and inline, with proper modifications)
Then ViewData appears as a type, and I cannot access it. My code seems to match what has been posted in ScottGu's tutorials. Of course, unless I am making a large oversight, and this does work, then there must be something subtle in my code that is off, and I'll have to post it later.
Thanks.