Represents a Adf.Web.UI.CharacterFilteringTextBox that only allows positive integer values through javascript. WARNING: A Adf.Web.UI.UnsignedIntegerTextBoxValidator should always be enclosed when using this control.

This Adf.Web.UI.CharacterFilteringTextBox contains a onkeypress event that catches illegal characters, based on the CurrentCulture of the user.

This Control should always be used together with a Adf.Web.UI.UnsignedIntegerTextBoxValidator, because users could have JavaScript turned off. This is the code for the validator: UnsignedIntegerTextBox ntb = new UnsignedIntegerTextBox(); ntb.ID = "UnsignedIntegerTextBox1"; UnsignedIntegerTextBoxValidator cv = new UnsignedIntegerTextBoxValidator(); cv.ControlToValidate = ntb.ID;

Inheritance: CharacterFilteringTextBox
示例#1
0
        /// <summary>
        /// Render the <see cref="System.Web.UI.WebControls.TextBox"/> for Unsigned Integer value
        /// </summary>
        /// <param name="cs"><see cref="ControlStruct"/></param>
        /// <returns><see cref="System.Web.UI.WebControls.TextBox"/></returns>
        protected TextBox RenderUnsignedIntegerTextBox(ControlStruct cs)
        {
            UnsignedIntegerTextBox unsignedIntegerTextBox = new UnsignedIntegerTextBox();

            if (cs != null)
            {
                unsignedIntegerTextBox.ID = "txt" + cs.Name;
                unsignedIntegerTextBox.CssClass = ControlCellStyle.CssClass;
                unsignedIntegerTextBox.TextMode = TextBoxMode.SingleLine;
                unsignedIntegerTextBox.Wrap = false;
                unsignedIntegerTextBox.Enabled = cs.Enabled;
                unsignedIntegerTextBox.Width = Unit.Percentage(cs.Width);
            }
            return unsignedIntegerTextBox;
        }