/// <summary> /// 命令执行 /// </summary> public override void Execute() { if (this.Feature != null) { HttpContext.Current.Response.Write(this.Feature.ToAdjustWindowScriptBlock(true)); } HttpContext.Current.Response.Write(DeluxeClientScriptManager.AddScriptTags(string.Format("window.navigate(\"{0}\");", WebUtility.CheckScriptString(NavigateUrl)))); HttpContext.Current.Response.End(); }
/// <summary> /// 对话框状态下,根据ViewState属性生成客户端清理ViewState的脚本 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void dialogPage_PreRenderComplete(object sender, EventArgs e) { Page page = (Page)sender; Control ctr = (Control)page.Items[PageExtension.PageRenderControlItemKey]; if (page.IsCallback == false) { if (ctr.EnableViewState == false) { DeluxeClientScriptManager.RegisterStartupScript(page, "document.getElementById('__VIEWSTATE').value = '';"); } } }
/// <summary> /// 获取调整窗口大小和位置脚本 /// </summary> /// <param name="windowFeature"></param> /// <param name="addScriptTags"></param> /// <returns></returns> public static string GetAdjustWindowScriptBlock(IWindowFeature windowFeature, bool addScriptTags) { string requireScript = WebUtility.GetRequiredScriptBlock(typeof(DeluxeScript)); string clintObject = WindowFeatureHelper.GetClientObject(windowFeature); //string callScript = string.Format("$HGRootNS.WindowFeatureFunction.adjustWindow({0});", clintObject); string callScript = string.Format("$HGRootNS.WindowFeatureFunction.registerAdjustWindow({0});", clintObject); string script = string.Format("{0}\n{1}", requireScript, callScript); if (addScriptTags) { script = DeluxeClientScriptManager.AddScriptTags(script); } return(script); }