protected void Page_Load(object sender, EventArgs e) { // Create extender NumericUpDownExtender exNumeric = new NumericUpDownExtender(); exNumeric.ID = "exNum"; exNumeric.TargetControlID = textbox.ID; exNumeric.EnableViewState = false; Controls.Add(exNumeric); // Initialize extender exNumeric.Minimum = Minimum; exNumeric.Maximum = Maximum; exNumeric.Step = Step; exNumeric.Width = Width; LoadValues(); if ((values != null) && (values.Count > 0)) { string refValues = null; foreach (string key in values.Keys) { refValues += key + ";"; } exNumeric.RefValues = refValues.TrimEnd(';'); } // Initialize up button if (!string.IsNullOrEmpty(UpButtonImageUrl)) { btnUp.Visible = true; btnUp.ImageUrl = UpButtonImageUrl; btnUp.AlternateText = CMSContext.CurrentResolver.ResolveMacros(UpButtonImageAlternateText); btnUp.ImageAlign = ImageAlign.Middle; exNumeric.TargetButtonUpID = btnUp.ID; } // Initialize down button if (!string.IsNullOrEmpty(DownButtonImageUrl)) { btnDown.Visible = true; btnDown.ImageUrl = DownButtonImageUrl; btnDown.AlternateText = CMSContext.CurrentResolver.ResolveMacros(DownButtonImageAlternateText); btnDown.ImageAlign = ImageAlign.Middle; exNumeric.TargetButtonDownID = btnDown.ID; } exNumeric.ServiceDownMethod = ServiceDownMethod; exNumeric.ServiceDownPath = ServiceDownPath; exNumeric.ServiceUpMethod = ServiceUpMethod; exNumeric.ServiceUpPath = ServiceUpPath; exNumeric.Tag = CMSContext.CurrentResolver.ResolveMacros(Tag); // Apply CSS styles if (!String.IsNullOrEmpty(this.CssClass)) { pnlContainer.CssClass = this.CssClass; this.CssClass = null; } if (!String.IsNullOrEmpty(this.ControlStyle)) { pnlContainer.Attributes.Add("style", this.ControlStyle); this.ControlStyle = null; } this.CheckRegularExpression = true; this.CheckFieldEmptiness = true; }
protected void Page_Load(object sender, EventArgs e) { // Create extender NumericUpDownExtender exNumeric = new NumericUpDownExtender(); exNumeric.ID = "exNum"; exNumeric.TargetControlID = textbox.ID; exNumeric.EnableViewState = false; Controls.Add(exNumeric); // Initialize extender exNumeric.Minimum = Minimum; exNumeric.Maximum = Maximum; exNumeric.Step = Step; exNumeric.Width = Width; // Disable checking changes before complete initialization textbox.Attributes.Add("data-ignorechanges", "true"); textbox.Width = Width; exNumeric.TargetButtonUpID = btnUp.ID; exNumeric.TargetButtonDownID = btnDown.ID; LoadValues(); if ((mValues != null) && (mValues.Count > 0)) { exNumeric.RefValues = String.Join(";", mValues.Keys); } // Initialize up button if (!string.IsNullOrEmpty(UpButtonImageUrl)) { btnImgUp.Visible = true; btnUp.Visible = false; btnImgUp.ImageUrl = UpButtonImageUrl; btnImgUp.AlternateText = ContextResolver.ResolveMacros(UpButtonImageAlternateText); btnImgUp.ImageAlign = ImageAlign.Middle; exNumeric.TargetButtonUpID = btnImgUp.ID; } // Initialize down button if (!string.IsNullOrEmpty(DownButtonImageUrl)) { btnImgDown.Visible = true; btnDown.Visible = false; btnImgDown.ImageUrl = DownButtonImageUrl; btnImgDown.AlternateText = ContextResolver.ResolveMacros(DownButtonImageAlternateText); btnImgDown.ImageAlign = ImageAlign.Middle; exNumeric.TargetButtonDownID = btnImgDown.ID; } exNumeric.ServiceDownMethod = ServiceDownMethod; exNumeric.ServiceDownPath = ServiceDownPath; exNumeric.ServiceUpMethod = ServiceUpMethod; exNumeric.ServiceUpPath = ServiceUpPath; exNumeric.Tag = ContextResolver.ResolveMacros(Tag); // Apply CSS styles if (!String.IsNullOrEmpty(CssClass)) { pnlContainer.CssClass = CssClass; CssClass = null; } if (!String.IsNullOrEmpty(ControlStyle)) { pnlContainer.Attributes.Add("style", ControlStyle); ControlStyle = null; } CheckRegularExpression = true; CheckFieldEmptiness = true; }
protected override void CreateChildControls() { Controls.Clear(); if (!this.DesignMode) { _numericUpDownExtender = new NumericUpDownExtender(); _numericUpDownExtender.ID = "_numericUpDownExtender"; this.Controls.Add(_numericUpDownExtender); } }