/// <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); }
/// <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); }
/// <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>"); } }