-
Website
http://www.emadibrahim.com -
Original page
http://www.emadibrahim.com/2008/03/31/ajax-with-aspnet-mvc-framework-preview-2/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
danatkinson
1 comment · 1 points
-
Korayem
3 comments · 1 points
-
dukon21
1 comment · 1 points
-
Mladen Mihajlovic
1 comment · 1 points
-
Chad Myers
3 comments · 1 points
-
-
Popular Threads
-
Select Random Records Using Nhibernate
3 weeks ago · 4 comments
-
Select Random Records Using Nhibernate
Thus if you try the following (List.aspx):
this.RenderPartial("UserList", ViewData.Users);
where UserList is a UserControl (ascx), the RenderPartial calls List.aspx again.
To fix this I changed the RenderPartialCore method to:
private static void RenderPartialCore(ViewContext viewContext, string viewName, object viewData)
{
if (String.IsNullOrEmpty(viewName))
throw new ArgumentNullException(viewName);
// TODO: Need to be able to get the view engine associated with this controller
// without the cast to the specific implementation
Controller controller = (Controller)viewContext.Controller;
// create a new view context for the view called, not the existing view
ViewContext newContext = new ViewContext(controller.ControllerContext, viewName, null, viewData, controller.TempData);
//emad ibrahim: controller has a viewengine already
controller.ViewEngine.RenderView(newContext);
//IViewFactory viewFactory = controller.ViewFactory;
//IView partialView = viewFactory.CreateView(viewContext, viewName, null, viewData);
//partialView.RenderView(viewContext);
}
Any thoughts? Updates? I am using preview 2 the interim release. Please answer quickly I am so stuck...
@Christian: I am not sure what is going on here. I personally never used ContainsDataItem method on ViewData because I always used a typed ViewData.
I have a BaseViewData that is used on the master page and every page using that master and then I create derived classes for ViewData for each page e.g. UserInfoViewData, etc...