Ejemplo n.º 1
0
        private void RenderViewPage(ViewContext context, DlrViewPage page) {
            if (!String.IsNullOrEmpty(MasterPath)) {
                page.MasterLocation = MasterPath;
            }

            IViewDataContainer dataContainer = page as IViewDataContainer;
            if (dataContainer != null) {
                dataContainer.ViewData = context.ViewData;
            }
            
            page.RenderView(context);
        }
Ejemplo n.º 2
0
        private void RenderViewPage(ViewContext context, DlrViewPage page)
        {
            if (!String.IsNullOrEmpty(MasterPath))
            {
                page.MasterLocation = MasterPath;
            }

            IViewDataContainer dataContainer = page as IViewDataContainer;

            if (dataContainer != null)
            {
                dataContainer.ViewData = context.ViewData;
            }

            page.RenderView(context);
        }
Ejemplo n.º 3
0
        public virtual void Render(ViewContext viewContext, TextWriter writer)
        {
            if (viewContext == null)
            {
                throw new ArgumentNullException("viewContext");
            }

            object viewInstance = BuildManager.CreateInstanceFromVirtualPath(ViewPath, typeof(object));

            if (viewInstance == null)
            {
                throw new InvalidOperationException(
                          String.Format(
                              CultureInfo.CurrentUICulture,
                              "",
                              ViewPath));
            }

            DlrViewPage viewPage = viewInstance as DlrViewPage;

            if (viewPage != null)
            {
                RenderViewPage(viewContext, viewPage);
                return;
            }

            ViewUserControl viewUserControl = viewInstance as ViewUserControl;

            if (viewUserControl != null)
            {
                RenderViewUserControl(viewContext, viewUserControl);
                return;
            }

            throw new InvalidOperationException(
                      String.Format(
                          CultureInfo.CurrentUICulture,
                          "",
                          ViewPath));
        }