public void MostrarMensajeCheto(String titulo, String mensajeAyuda, Label labelAyuda, System.Web.UI.UpdatePanel contenedor) { string script = "$('#ventanaAyuda').modal('show');"; labelAyuda.Text = crearAyudaModal(titulo, mensajeAyuda, script); labelAyuda.Visible = true; System.Web.UI.ScriptManager.RegisterStartupScript(contenedor, contenedor.GetType(), Guid.NewGuid().ToString(), script, true); }
public static void AddSPNotification(UpdatePanel updSettings, string text, bool isRefresh) { if (String.IsNullOrEmpty(text) == false) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(string.Format("SP.UI.Notify.addNotification(\"{0}\");", text)); if (isRefresh == true) { stringBuilder.AppendLine("SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 1);"); stringBuilder.AppendLine("window.frameElement.commitPopup();"); } ScriptManager.RegisterClientScriptBlock(updSettings, updSettings.GetType(), Guid.NewGuid().ToString(), stringBuilder.ToString(), true); } }
/// <summary> /// 控件点击 消息确认提示框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</param> public static void ShowUpdatePanelConfirm(System.Web.UI.UpdatePanel Control, string msg) { System.Web.UI.ScriptManager.RegisterOnSubmitStatement(Control, Control.GetType(), "test", "return confirm('" + msg + "');"); // ScriptManager.RegisterOnSubmitStatement(UpdatePanel1, this.GetType(),"test", "return window.confirm('test')"); }
/// <summary> /// 控件点击 消息提示框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</param> public static void ShowUpdatePanel(System.Web.UI.UpdatePanel Control, string msg) { //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}"); //Control.Attributes.Add("onclick", "return confirm('" + msg + "');"); System.Web.UI.ScriptManager.RegisterStartupScript(Control, Control.GetType(), "unReport", "alert('" + msg + "');", true); }
public static void MuestraMensajeAJAX(System.Web.UI.UpdatePanel up, string strMessage) { string strScript = "alert(' " + strMessage + " ');"; System.Web.UI.ScriptManager.RegisterStartupScript(up, up.GetType(), "msgbox", strScript, true); }
/// <summary> /// 区域警告(AJAX|带信息提示) /// </summary> /// <param name="page"></param> /// <param name="content"></param> public static void AjaxWarning(UpdatePanel UP, string id, string msg) { ScriptManager.RegisterStartupScript(UP, UP.GetType(), "Warning" + id, "Warning('" + id + "','" + msg + "');", true); }
/// <summary> /// 显示提示信息(AJAX) /// </summary> /// <param name="page"></param> /// <param name="content"></param> public static void AjaxShowMsg(UpdatePanel UP, string content, int type) { i++; ScriptManager.RegisterStartupScript(UP, UP.GetType(), "ShowMsg" + i, "ShowMsg2('" + content + "',1);", true); }
/// <summary> /// 注册脚本(AJAX) /// </summary> /// <param name="page"></param> public static void AjaxRegisterScript(UpdatePanel UP, string script) { i++; ScriptManager.RegisterStartupScript(UP, UP.GetType(), "js" + i, script, true); }
public static void RunScript(this System.Web.UI.UpdatePanel ctl, string script) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(ctl, ctl.GetType(), "Scripts", script, true); }
public static void CloseControl(this System.Web.UI.UpdatePanel udPnl, string dialogID) { string Script = @"CloseControl('{0}');"; // 注意,有經過String.Format的話大括號要重複 System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Close", String.Format(Script, dialogID), true); }
public static void Show(this System.Web.UI.UserControl ctl, System.Web.UI.UpdatePanel udPnl, string Message) { string Script = @"alert('{0}');"; // 注意,有經過String.Format的話大括號要重複 System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Message", String.Format(Script, Message.Replace("\r\n", "\\n").Replace("'", "\\'").Replace("\"", "\\\"")), true); }
public static void ShowControl(this System.Web.UI.UpdatePanel udPnl, string dialogID, string titleName) { string Script = @"LoadControl('{0}', '{1}', '{2}');"; // 注意,有經過String.Format的話大括號要重複 System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Show", String.Format(Script, dialogID, titleName, udPnl.Page.ResolveUrl("~/img/closebutton.ico")), true); }
protected void CreateClientScript(String sJavaScriptFunction, UpdatePanel oUpdatePanel) { Guid gMessage = Guid.NewGuid(); ScriptManager.RegisterStartupScript(oUpdatePanel, oUpdatePanel.GetType(), gMessage.ToString(), sJavaScriptFunction, true); }
public static void Show(UpdatePanel objUpdatePanel, string Mensaje) { string alert = String.Format("alert('{0}');", Mensaje); Guid guidKey = Guid.NewGuid(); ScriptManager.RegisterStartupScript(objUpdatePanel, objUpdatePanel.GetType(), guidKey.ToString(), alert, true); }
/// <summary>Método que registra um javascript</summary> public static void RegistraJavascript(UpdatePanel updPanel, string javascript) { string msgScript = javascript; ScriptManager.RegisterStartupScript(updPanel, updPanel.GetType(), msgScript, msgScript, true); }
protected void ShowUpdatePanelAlert(UpdatePanel updatePanel,string message) { ScriptManager.RegisterStartupScript( updatePanel, updatePanel.GetType(), Guid.NewGuid().ToString(), " alert('"+ message + "');", true); }