コード例 #1
0
		public virtual void Process(ViewContext viewContext, TextWriter writer)
		{
			Contract.Assert(writer != null);

			object viewInstance = WebFormFactory.CreateInstanceFromVirtualPath(ViewPath, typeof(object));
			if (viewInstance == null)
			{
				throw new InvalidOperationException(
					String.Format(
						CultureInfo.CurrentUICulture,
						"WebForm Page could not be created: {0}",
						ViewPath));
			}

			ViewPage viewPage = viewInstance as ViewPage;
			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,
					"Invalid view base class: {0}",
					ViewPath));
		}
コード例 #2
0
		private void RenderViewPage(ViewContext context, ViewPage page)
		{
			if (!String.IsNullOrEmpty(MasterPath))
			{
				page.MasterLocation = MasterPath;
			}

//            page.ViewData = context.ViewData;
			page.RenderView(context);
		}