Exception Accessing ViewData from a ViewUserControl

Last post 04-27-2008 3:00 AM by AirHead3.0. 0 replies.

Sort Posts:

  • Exception Accessing ViewData from a ViewUserControl

    04-27-2008, 3:00 AM
    • Member
      17 point Member
    • AirHead3.0
    • Member since 07-05-2006, 12:23 PM
    • Posts 14

    Using the latest source drop (pre-preview 3?), I'm getting the following exception:

    The ViewUserControl '' cannot find an IViewDataContainer. The ViewUserControl must be inside a ViewPage, ViewMasterPage, or another ViewUserControl.

    This is occuring on a ViewUserControl<MyViewData> on a ViewMasterPage<MyViewData> (rendering a ViewPage<MyData>). It happens if I add it as a normal user control or use the Html.RenderUserControl() helper method (MyViewData is just a class with a few properties).

     How should I be doing this?

Page 1 of 1 (1 items)