刷新页面(父子页面、自身页码)

刷新页面(父子页面、自身页码)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Salien.Utility.SUWF;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text.RegularExpressions;
namespace YJSBCL.common
{
    public class Refresh 
    {
        #region 刷新父、子页面
        /// <summary>
        /// 刷新父页面
        /// </summary>
        public void RefreshParentPage(SlnSuwfPage _page)
        {
            //_page.btnQuery_Click(null, null);

            string strJS = "<script type='text/javascript'>"
                    + "var pWindow = window.parent.opener;"
                    + "if(pWindow != null && pWindow.document.all.btnQuery != null)"
                    + "{pWindow.document.all.btnQuery.click();}"
                    + "pWindow = window.parent.parent;"
                    + "if(pWindow != null && pWindow.gridframe != null && pWindow.gridframe.document.all.btnQuery != null)"
                    + "{pWindow.gridframe.document.all.btnQuery.click();}"
                    + " </script>";
            _page.ClientScript.RegisterStartupScript(this.GetType(), "RfreshParent", strJS);
        }
#endregion

#region 刷新父、子页面
        /// <summary>
        /// 刷新子页面
        /// </summary>
        public void RefreshChildPage(SlnSuwfPage _page)
        {
            //_page.btnQuery_Click(null, null);

            string strJS = "<script type='text/javascript'>"
                    + "var pWindow = window.parent;window.parent.cardframe.document.location.reload();"
                    + " </script>";
            _page.ClientScript.RegisterStartupScript(this.GetType(), "RfreshChild", strJS);
        }
        #endregion

    }
}




 public static void RefreshPage(SlnSuwfPage page)
        {
            string strScript = @"<script>
                                    var pWindow=window.parent.parent.parent;                                   
                                    pWindow.location.reload(true);   
                                </script>";
            page.Response.Write(strScript);
        }

        public static void RefreshParentPage1(SlnSuwfPage page)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<script>\n");
            sb.Append("pWindow = window.parent.parent;\n");
            sb.Append("if(pWindow != null && pWindow.gridframe != null && pWindow.gridframe.document.all.btnQuery != null)\n");
            sb.Append("{pWindow.gridframe.document.all.btnQuery.click();}\n");
            sb.Append("</script>");
            page.Response.Write(sb.ToString());
        }
 //刷新父页面
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<script>\n");
                    sb.Append("pWindow = window.parent.parent;\n");
                    sb.Append("if(pWindow != null && pWindow.gridframe != null && pWindow.gridframe.document.all.btnQuery != null)\n");
                    sb.Append("{pWindow.gridframe.document.all.hfRefresh.value=1;pWindow.gridframe.document.all.btnQuery.click();}\n");
                    sb.Append("pWindow = window.parent.opener;\n");
                    sb.Append("if(pWindow != null && pWindow.document.all.btnQuery != null)\n");
                    sb.Append("{pWindow.document.all.btnQuery.click();}\n");
                    sb.Append("</script>");
                    page.Response.Write(sb.ToString());

        public static void RefreshSelf(SlnSuwfPage page)
        {
            string strScript = @"<script>
        var pWindow=window.parent;
                    pWindow.location.reload(true);   
                                </script>";
            page.Response.Write(strScript);
        }

        public static void RefreshOpener(SlnSuwfPage page)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<script>\n");
            sb.Append("var pWindow = window.parent.opener;\n");
            sb.Append("if(pWindow != null)\n");
            sb.Append("{pWindow.location.reload(true);}\n");
            sb.Append("</script>");
            page.Response.Write(sb.ToString());
        }


          #region
        public static void RefreshSelf(SlnSuwfPage page)
        {//刷新当前页面,尤其是用于网格
            string strScript = @"<script>
                                    window.location.href=window.location.href;   
                                </script>";
            page.ShowMessage(strScript);
        }
        #endregion


//关闭子页面,刷新父页面
StringBuilder sb = new StringBuilder();
                sb.Append("<script>\n");
                sb.Append("var p = getParentWin();\n");
                sb.Append("p.location.href = p.location.href;\n");
                sb.Append(" closeWin();\n");              
                sb.Append("</script>");
                _page.ShowMessage(sb.ToString());

 

posted @ 2025-08-19 17:34  知行一体2  阅读(11)  评论(0)    收藏  举报