private void RenderViewPage(ViewContext context, ViewPage page) { if (!String.IsNullOrEmpty(MasterPath)) { page.MasterLocation = MasterPath; } page.ViewData = context.ViewData; page.RenderView(context); }
internal static void RenderViewAndRestoreContentType(ViewPage containerPage, ViewContext viewContext) { // We need to restore the Content-Type since Page.SetIntrinsics() will reset it. It's not possible // to work around the call to SetIntrinsics() since the control's render method requires the // containing page's Response property to be non-null, and SetIntrinsics() is the only way to set // this. string savedContentType = viewContext.HttpContext.Response.ContentType; containerPage.RenderView(viewContext); viewContext.HttpContext.Response.ContentType = savedContentType; }
private void RenderViewPage(ViewContext context, ViewPage page) { if (!String.IsNullOrEmpty(BaseView.MasterPath)) { page.MasterLocation = BaseView.MasterPath; } page.ViewData = context.ViewData; page.PreLoad += (sender, e) => BuildUpMasterPage(page.Master); page.RenderView(context); }
private void RenderViewPage(ViewContext context, ViewPage page) { if(!string.IsNullOrEmpty(this.MasterPath)) page.MasterLocation = this.MasterPath; page.Init += delegate { //动态添加页面内容 this.GeneratePageContent(context, page); }; page.ViewData = context.ViewData; page.RenderView(context); }