Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctr"></param>
        /// <param name="renderMode"></param>
        public static void CheckOnlyRenderSelf(Control ctr, ControlRenderMode renderMode)
        {
            if (renderMode.OnlyRenderSelf && renderMode.UseNewPage && ctr.Page.Items[WebUtility.PageRenderControlItemKey] != ctr)
            {
                Page currentPage = ctr.Page;
                ctr.Parent.Controls.GetType().GetMethod("SetCollectionReadOnly", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(ctr.Parent.Controls, new object[1] {
                    null
                });
                Page page = new Page();
                PageRenderModePageCache currentPageCache = PageRenderModeHelper.GetPageRenderModeCache(currentPage);
                PageRenderModePageCache pageCache        = PageRenderModeHelper.GetPageRenderModeCache(page);
                SetPageLevel(pageCache, GetPageLevel(currentPageCache) + 1);
                string currentPageUniqueID = GetPageUniqueID(currentPageCache);
                if (currentPageUniqueID != string.Empty)
                {
                    currentPageUniqueID += ",";
                }
                SetPageUniqueID(pageCache, string.Format("{0}{1}", GetPageUniqueID(currentPageCache), ctr.UniqueID));
                page.AppRelativeVirtualPath = ctr.Page.AppRelativeVirtualPath;
                page.EnableEventValidation  = false;

                InitNewPageContent(page, ctr);

                WebUtility.AttachPageModules(page);

                page.ProcessRequest(HttpContext.Current);

                HttpContext.Current.Response.End();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="target"></param>
        /// <param name="feature"></param>
        public override void Execute()
        {
            //if (this.Feature != null)
            //{
            //    //不加这句表单样式有问题
            //    HttpContext.Current.Response.Write("<!DOCTYPE html>\n");
            //    HttpContext.Current.Response.Write(this.Feature.ToAdjustWindowScriptBlock(true));
            //    HttpContext.Current.Response.Flush();
            //}

            PageHandlerFactory factory = (PageHandlerFactory)Activator.CreateInstance(typeof(System.Web.UI.PageHandlerFactory), true);

            Uri url = new Uri(HttpContext.Current.Request.Url, this.NavigateUrl);

            IHttpHandler handler = factory.GetHandler(HttpContext.Current,
                                                      HttpContext.Current.Request.RequestType,
                                                      url.AbsolutePath, HttpContext.Current.Request.PhysicalApplicationPath);

            if (handler is Page)
            {
                HttpContext.Current.Items["transferTarget"] = AppendCurrentRequestParams(this.NavigateUrl);

                ((Page)handler).PreRenderComplete += new EventHandler(TransferCommand_PreRenderComplete);

                //add by zhouweihai 2008-09-02 页面加载PageModule
                WebUtility.AttachPageModules((Page)handler);
            }

            StringBuilder strB = new StringBuilder(10240);

            TextWriter tw = new StringWriter(strB);

            HttpContext.Current.Server.Execute(handler, tw, true);

            HttpContext.Current.Response.Write(tw.ToString());
            HttpContext.Current.Response.End();
        }
Пример #3
0
        /// <summary>
        /// 如果请求是提醒对话框的,则处理该请求,显示提醒对话框的内容
        /// </summary>
        private void DoNotifyDialog()
        {
            if (HttpContext.Current.Request.RequestType == "POST")
            {
                string taskID     = HttpContext.Current.Request.QueryString["taskID"];
                string taskSource = WebUtility.GetRequestFormString("taskSource", "userTask");

                if (string.IsNullOrEmpty(taskID) == false && GetAutoTransferToCompletedTask())
                {
                    UserTask task = new UserTask();
                    task.TaskID = taskID;
                    UserTaskCollection tasks = new UserTaskCollection();
                    tasks.Add(task);
                    if (taskSource == "userTask")
                    {
                        UserTaskAdapter.Instance.DeleteUserTasks(tasks);
                    }
                    else
                    {
                        UserTaskAdapter.Instance.DeleteUserAccomplishedTasks(tasks);
                    }
                }

                SaveAutoTransferToCompletedTaskFlag();

                //WebUtility.ResponseRefreshParentWindowScriptBlock();
                HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());
                WebUtility.ResponseTimeoutScriptBlock("top.close();", ExtScriptHelper.DefaultResponseTimeout);

                HttpContext.Current.Response.End();
            }
            else
            {
                Page page = new Page();

                HtmlGenericControl html = new HtmlGenericControl("html");
                WebUtility.SetCurrentPage(page);
                page.Controls.Add(html);

                HtmlHead head = new HtmlHead();
                html.Controls.Add(head);

                HtmlTitle title = new HtmlTitle();
                title.Text = Translator.Translate(Define.DefaultCulture, "提醒消息");
                head.Controls.Add(title);

                HtmlGenericControl body = new HtmlGenericControl("body");
                html.Controls.Add(body);

                WebUtility.AttachPageModules(page);

                string temmplate = GetNotifyDialogHtml();
                string pageHtml  = InitNotifyDialogPage(temmplate);

                body.Controls.Add(new LiteralControl(pageHtml));

                ((IHttpHandler)page).ProcessRequest(HttpContext.Current);

                HttpContext.Current.Response.End();
            }
        }