Beispiel #1
0
        public static void OpenModal(string url, System.Web.UI.UpdatePanel updatePanel)
        {
            string script = "window.showModalDialog('" + url + "', window,'','')";

            Util.ReturnAjaxJS(script, updatePanel);

            #region Modal em JS
            //function openModal(pUrl, pWidth, pHeight) {
            //if (window.showModalDialog) {
            //    return window.showModalDialog(pUrl, window,
            //      "dialogWidth:" + pWidth + "px;dialogHeight:" + pHeight + "px");
            //} else {
            //    try {
            //        netscape.security.PrivilegeManager.enablePrivilege(
            //          "UniversalBrowserWrite");
            //        window.open(pUrl, "wndModal", "width=" + pWidth
            //          + ",height=" + pHeight + ",resizable=no,modal=yes");
            //        return true;
            //    }
            //    catch (e) {
            //        alert("Script não confiável, não é possível abrir janela modal.");
            //        return false;
            //        }
            //    }
            //}
            #endregion
        }
 public static void RegisterToUpdate(System.Web.UI.UpdatePanel updatePanel)
 {
     updatePanel.Update();
     if (HttpContext.Current.Session[SessionName] == null)
     {
         HttpContext.Current.Session[SessionName] = new List <string>();
     }
     ((List <string>)HttpContext.Current.Session[SessionName]).Add(updatePanel.ClientID);
 }
    public static bool IsUpdatingOrPageLoading(System.Web.UI.UpdatePanel updatePanel, System.Web.UI.Page page)
    {
        bool output = false;

        if (!page.IsPostBack || IsUpdating(updatePanel))
        {
            output = true;
        }
        return(output);
    }
    public static bool IsUpdating(System.Web.UI.UpdatePanel updatePanel)
    {
        bool output = false;

        // check if there is a JavaScript update request
        if (HttpContext.Current.Request["__EVENTTARGET"] == updatePanel.ClientID)
        {
            output = true;
        }
        // check if there is a code behind update request
        if (HttpContext.Current.Session[SessionName] != null &&
            ((List <string>)HttpContext.Current.Session[SessionName]).Contains(updatePanel.ClientID))
        {
            output = true;
            ((List <string>)HttpContext.Current.Session[SessionName]).Remove(updatePanel.ClientID);
        }
        return(output);
    }
 public static void Show(System.Web.UI.UpdatePanel panel, System.Web.UI.Page page, string msg)
 {
     msg = Regex.Replace(msg, @"[\n\r]", "");
     System.Web.UI.ScriptManager.RegisterClientScriptBlock(panel, page.GetType(), "message", "alert('" + msg.ToString() + "');", true);
 }
Beispiel #6
0
 /// <summary>
 /// 无刷新执行脚本
 /// </summary>
 /// <param name="updatePanel"></param>
 /// <param name="Script"></param>
 public static void RunScript(System.Web.UI.UpdatePanel updatePanel, string Script)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePanel, updatePanel.Page.GetType(), "Script", Script.ToString(), true);
 }
Beispiel #7
0
 public static void RedirectAjaxJS(System.Web.UI.UpdatePanel updatePanel, string url)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), "x", "window.location.href = '" + url + "'", true);
 }
Beispiel #8
0
 public static void AjaxAlertJs(System.Web.UI.UpdatePanel updatePanel, string msg)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), "alerta", "alert('" + msg + "');", true);
 }
Beispiel #9
0
        public static void OpenWindow(string url, System.Web.UI.UpdatePanel updatePanel)
        {
            string script = "w = screen.availWidth - 7; h = screen.availHeight - 57; window.open('" + url + "', 'window', 'toolbar=no,location=yes,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,width='+w+',height='+h);";

            Util.ReturnAjaxJS(script, updatePanel);
        }
Beispiel #10
0
        public static void OpenWindow(string url, int width, int height, System.Web.UI.UpdatePanel updatePanel)
        {
            string script = "window.open('" + url + "', 'window', 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=" + width + ",outerWidth=" + width + ",height=" + height + "');";

            Util.ReturnAjaxJS(script, updatePanel);
        }
Beispiel #11
0
 public static void ReturnAjaxJS(string script, System.Web.UI.UpdatePanel updatePanel)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), "js", script, true);
 }
Beispiel #12
0
 internal static void InvokeScript(System.Web.UI.UpdatePanel updatePane, Type type, string script)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePane, type, "updateScript", script, true);
 }
Beispiel #13
0
 internal static void AlertInUpdatePanel(System.Web.UI.UpdatePanel updatePanel, Type type, string msg)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(updatePanel, type, "updateScript", "alert('" + msg + "')", true);
 }