protected override void OnLoad(EventArgs e) { base.OnLoad(e); CssManager.AddStyleSheet(this, GetStylesheetUrl(), string.Empty); JSManager.AddExternalScript(this, "/JS/imgEvents.js"); JSManager.AddExternalScript(this, "/JS/popEvents.js"); }
/// <summary> /// Register the control to be notified of postback events. /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { /// Set up JavaScript resources. JSManager.AddResource(this.Page, typeof(DeleteList), "NCI.Web.UI.WebControls.FormControls.Resources.deleteList.js"); Page.RegisterRequiresPostBack(this); base.OnPreRender(e); }
// I know this method is obsolete, but i didn't find ahother place, where JSManager would work properly public override void RegisterClientScriptBlock(string key, string script) { base.RegisterClientScriptBlock(key, script); var renderer = JSManager.GetRenderer(this); JSManager.RegisterModule(renderer, typeof(PXChart), JS.AmChart); JSManager.RegisterModule(renderer, typeof(PXChart), JS.Chart); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!this.IsCallback) { var renderer = JSManager.GetRenderer(this); JSManager.RegisterModule(renderer, JS.BaseKey, JS.NetType); } }
protected override void CreateChildControls() { base.CreateChildControls(); // In this case the snippet info data is not HTML(which is often the case) // but xml data which contains rendering properties for each page option item processPageOptionsData(SnippetInfo.Data); JSManager.AddExternalScript(this.Page, "/JS/popEvents.js"); }
private void RegisterModules() { IScriptRenderer scriptRenderer = JSManager.GetRenderer(this.Page); JSManager.RegisterSystemModules(this.Page); JSManager.RegisterCallbackModules(this.Page); JSManager.RegisterModule(scriptRenderer, typeof(PXTextEdit), JS.TextEdit); JSManager.RegisterModule(scriptRenderer, typeof(PXCheckBox), JS.CheckBox); JSManager.RegisterModule(scriptRenderer, typeof(PXDropDown), JS.DropDown); }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected override void OnInit(EventArgs e) { if (!this.IsCallback) { var renderer = JSManager.GetRenderer(this); var scriptFiles = new List <string>(); PXContext.Session.PXSharedScriptFiles[JSManager.SharedScriptFilesKey] = scriptFiles; if (JSManager.GetBatchMode()) { scriptFiles.AddRange(new string[] { JS.BatchBase, JS.BatchEdit, JS.BatchGrid, AppJS.AppScriptBatch, AppJS.DashboardsBatch }); JSManager.RegisterScriptBatch(renderer, JS.BaseKey, JS.BatchBase); JSManager.RegisterScriptBatch(renderer, JS.BaseKey, JS.BatchEdit); JSManager.RegisterScriptBatch(renderer, JS.BaseKey, JS.BatchGrid); JSManager.RegisterScriptBatch(renderer, AppJS.BaseKey, AppJS.AppScriptBatch); JSManager.RegisterScriptBatch(renderer, AppJS.BaseKey, AppJS.DashboardsBatch); } else { var list = new List <KeyValuePair <Type, string[]> >(); list.Add(new KeyValuePair <Type, string[]>(JS.BaseKey, JS.BatchBaseFiles)); list.Add(new KeyValuePair <Type, string[]>(JS.BaseKey, JS.BatchEditFiles)); list.Add(new KeyValuePair <Type, string[]>(JS.BaseKey, JS.BatchGridFiles)); list.Add(new KeyValuePair <Type, string[]>(AppJS.BaseKey, AppJS.BatchAppFiles)); list.Add(new KeyValuePair <Type, string[]>(AppJS.BaseKey, AppJS.BatchDasboardFiles)); foreach (KeyValuePair <Type, string[]> pair in list) { foreach (string script in pair.Value) { JSManager.RegisterModule(renderer, pair.Key, script); scriptFiles.Add(script); } } } } this.project = this.Request.QueryString["Project"]; if (!string.IsNullOrEmpty(this.project)) { ProjectBrowserMaint.SelectProjectByName(this.project); } string screenID = this.Request.QueryString["EditScreenID"]; if (!string.IsNullOrEmpty(screenID)) { ProjectBrowserMaint.ContextScreenID = screenID; } base.OnInit(e); }
/// <summary> /// The method gets notified from the server control and performs any necessary /// pre-rendering steps prior to saving view state and rendering content /// </summary> /// <param name="e">Contains the event data</param> protected override void OnPreRender(EventArgs e) { // Order is important. // The control's JavaScript component relies on Prototype being present first. PrototypeManager.Load(this.Page); JSManager.AddResource(this.Page, typeof(AutoComplete), "NCI.Web.UI.WebControls.FormControls.Resources.AutoComplete.js"); CssManager.AddResource(this.Page, typeof(AutoComplete), "NCI.Web.UI.WebControls.FormControls.Resources.AutoComplete.css"); // Register this control to require postback handling when the page // is posted back to the server Page.RegisterRequiresPostBack(this); }
protected override void OnInitComplete(EventArgs e) { base.OnInitComplete(e); if (!string.IsNullOrEmpty(Request.QueryString["ctrl"])) { var renderer = JSManager.GetRenderer(this); JSManager.RegisterVar(renderer, this.GetType(), "fileLinkDialog", Request.QueryString["ctrl"]); } var graph = ds.DataGraph as UploadFileInq; //.Views["SelectedScreen"].Cache; if (null != graph) { var cache = graph.FileDialog.Cache; if (null != cache && cache.Current != null) { var mode = cache.Current as PX.SM.FileDialog; if (null != mode) { if (mode.Entity == null) { Guid g; if (Guid.TryParse(Request.QueryString["note"], out g)) { mode.Entity = g; } } if (mode.Entity != null) { graph.Actions["GetFile"].SetVisible(false); graph.Actions["GetFileLink"].SetVisible(false); graph.Actions["DeleteFile"].SetVisible(false); } else { graph.Actions["AddLink"].SetVisible(false); graph.Actions["AddLinkClose"].SetVisible(false); } } } //if (fromFileDialog) //{ // graph.Actions["GetFile"].SetVisible(false); // graph.Actions["GetFileLink"].SetVisible(false); // graph.Actions["DeleteFile"].SetVisible(false); //} //else //{ // graph.Actions["AddLink"].SetVisible(false); // graph.Actions["AddLinkClose"].SetVisible(false); //} } //var scrn = cache.Current as PX.Data.AttribParams; }
/// <summary> /// Pre-render event handler. Register requiered CSS classes and scripts /// </summary> protected override void OnPreRender(EventArgs e) { // register CSS-styles this.RegisterCSS("dhtmlxgantt", "PX.Web.Controls.PC.Content.dhtmlxgantt.css"); // register embeded java script and initialize script blocks if (this.EnableClientScript) { //this.Page.RegisterRequiresPostBack(this); JSManager.Register(this); } base.OnPreRender(e); }
/// <summary> /// Register the control to be notified of postback events. /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { ClientScriptManager cs = Page.ClientScript; Type myType = typeof(TwoListSelect); // Order is important. // The control's JavaScript component relies on Prototype being present first. PrototypeManager.Load(this.Page); JSManager.AddResource(this.Page, typeof(TwoListSelect), "NCI.Web.UI.WebControls.FormControls.Resources.TwoListSelect.js"); Page.RegisterRequiresPostBack(this); base.OnPreRender(e); }
/// <summary> /// Override PreRender to include custom javascript /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { if (MaxLength > 0 && TextMode == TextBoxMode.MultiLine) { // Add javascript handlers for paste and keypress // Attributes.Add("onkeypress", "textAreaMaxLengthDoKeypress(this);"); // Attributes.Add("onbeforepaste", "textAreaMaxLengthDoBeforePaste(this);"); // Attributes.Add("onpaste", "textAreaMaxLengthDoPaste(this);"); Attributes.Add("onmousemove", "TextMaxLenValidator.countChars(event, this, '"+ this.ClientID+ "_count')"); Attributes.Add("onpropertychange", "TextMaxLenValidator.countChars(event, this, '" + this.ClientID + "_count')"); // Add attribute for access of maxlength property on client-side Attributes.Add("maxLength", this.MaxLength.ToString()); // Register client side include - only once per page JSManager.AddResource(this.Page, typeof(TextAreaMaxLengthControl), "NCI.Web.UI.WebControls.FormControls.Resources.TextAreaMaxLengthValidator.js"); this.Page.ClientScript.RegisterStartupScript(typeof(TextAreaMaxLengthControl), "SetMaxLength", "<script type=\"text/javascript\">TextMaxLenValidator.setMaxLength(" + this.MaxLength.ToString() + ", '" + this.ClientID + "_count') </script>"); } }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected void Page_Init(object sender, EventArgs e) { var lifetimeScope = this.Context.GetLifetimeScope(); if (lifetimeScope != null) { screenRepository = lifetimeScope.Resolve <IScreenRepository>(); } else { var serviceLocator = ServiceLocator.Current; screenRepository = serviceLocator.GetInstance <IScreenRepository>(); } JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle); if (screenID == null) { this.screenID = ControlHelper.GetScreenID(); } if (screenTitle == null) { if (System.Web.SiteMap.CurrentNode != null) { if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null) { screenTitle = PXSiteMap.CurrentNode.Title; } else { screenTitle = company; } } } string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle]; if (!string.IsNullOrEmpty(hide)) { this.Visible = false; return; } this.Page.InitComplete += new EventHandler(Page_InitComplete); PXCallbackManager.GetInstance().PreGetCallbackResult += PreGetCallbackResult; tlbPath.Items["syncTOC"].Visible = false; tlbPath.Items["branch"].Visible = false; if (!this.Page.IsCallback) { ((WebControl)LabelScreen.Parent).CssClass = "pageTitleCont"; } if (PXDataSource.RedirectHelper.IsPopupPage(Page)) { if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID)) { tlbPath.Items["syncTOC"].Visible = false; } this.FavoriteAvailable = false; if (!PXDataSource.RedirectHelper.IsPopupInline(Page)) { GetBranchCombo().Enabled = false; } } if (PXSiteMap.IsPortal) { this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole); this.BranchAvailable = false; this.FavoriteAvailable = false; pnlTBR.CssClass = "panelTBRSP"; } if (PXContext.PXIdentity.Authenticated) { userName = PXContext.PXIdentity.IdentityName; string branch = PXAccess.GetBranchCD(); if (!string.IsNullOrEmpty(branch)) { userName += ":" + branch; } } var date = PXContext.GetBusinessDate(); if (date != null) { PXDateTimeEdit.SetDefaultDate((DateTime)date); } if (!Page.IsCallback) { Session.Remove("StoredSearch"); } Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jq", VirtualPathUtility.ToAbsolute("~/Scripts/jquery-3.1.1.min.js")); Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jqsr", VirtualPathUtility.ToAbsolute("~/Scripts/jquery.signalR-2.2.1.min.js")); Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "hb", VirtualPathUtility.ToAbsolute("~/signalr/hubs")); }
//------------------------------------------------------------------------- /// <summary> /// Perform the additional JavaScript modules registration. /// </summary> void IPXScriptControl.RegisterModules(JSManager sm) { sm.RegisterModule(typeof(PXGantt), "PX.Web.Controls.PC.Scripts.px_gantt.js"); sm.RegisterModule(typeof(PXGantt), "PX.Web.Controls.PC.Scripts.dhtmlxgantt.js"); }
/// <summary> /// Perform the additional JavaScript variables registration. /// </summary> void IPXScriptControl.RegisterVariables(JSManager sm) { }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected void Page_Init(object sender, EventArgs e) { string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle]; if (!string.IsNullOrEmpty(hide)) { this.Visible = false; return; } this.Page.InitComplete += new EventHandler(Page_InitComplete); if (PXDataSource.RedirectHelper.IsPopupPage(Page)) { if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID)) { tlbPath.Items["syncTOC"].Visible = false; } this.FavoriteAvailable = false; if (!PXDataSource.RedirectHelper.IsPopupInline(Page)) { GetBranchCombo().Enabled = false; } } if (PXSiteMap.IsPortal) { this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole); this.BranchAvailable = false; this.FavoriteAvailable = false; pnlTBR.CssClass = "panelTBRSP"; } JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle); if (PXContext.PXIdentity.Authenticated) { userName = PXContext.PXIdentity.IdentityName; string branch = PXAccess.GetBranchCD(); if (!string.IsNullOrEmpty(branch)) { userName += ":" + branch; } } if (screenID == null) { this.screenID = ControlHelper.GetScreenID(); } if (screenTitle == null) { this.screenID = ControlHelper.GetScreenID(); //PX.Common.PXContext.SetScreenID(screenID); // moved to data source if (System.Web.SiteMap.CurrentNode != null) { if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null) { screenTitle = PXSiteMap.CurrentNode.Title; } else { screenTitle = company; } } } var date = PXContext.GetBusinessDate(); if (date != null) { PXDateTimeEdit.SetDefaultDate((DateTime)date); } if (!Page.IsCallback) { Session.Remove("StoredSearch"); } Uploader.FileUploadFinished += Uploader_FileUploadFinished; tlbTools.ItemCreate += tlbTools_ItemCreate; }
//--------------------------------------------------------------------------- /// <summary> /// The page Init event handler. /// </summary> protected void Page_Init(object sender, EventArgs e) { this.Page.InitComplete += new EventHandler(Page_InitComplete); if (PXDataSource.RedirectHelper.IsPopupPage(Page)) { tlbPath.Items["syncTOC"].Visible = false; tlbPath.Items["favorites"].Visible = false; tlbPath.Items["branch"].Visible = false; } if (PXSiteMap.IsPortal) { tlbPath.Items["branch"].Visible = false; tlbPath.Items["favorites"].Visible = false; pnlTitle.CssClass = "pageTitleSP"; pnlTBR.CssClass = "panelTBRSP"; tlbTools.Items["help"].CssClass = "toolsBtnSP"; HtmlAnchor label = tlbPath.FindControl("lblScreenTitle") as HtmlAnchor; if (label != null) { label.Attributes["class"] = "linkTitleSP"; } } JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle); if (PXContext.PXIdentity.Authenticated) { userName = PXContext.PXIdentity.IdentityName; string branch = PXAccess.GetBranchCD(); if (!string.IsNullOrEmpty(branch)) { userName += ":" + branch; } } if (screenID == null && screenTitle == null) { this.screenID = ControlHelper.GetScreenID(); PX.Common.PXContext.SetScreenID(screenID); if (System.Web.SiteMap.CurrentNode != null) { if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null) { screenTitle = PXSiteMap.CurrentNode.Title; } else { screenTitle = company; } } } var date = PXContext.GetBusinessDate(); if (date != null) { PXDateTimeEdit.SetDefaultDate((DateTime)date); } if (!Page.IsCallback) { Session.Remove("StoredSearch"); } Uploader.FileUploadFinished += Uploader_FileUploadFinished; tlbTools.ItemCreate += tlbTools_ItemCreate; }