maxlength property on RadFilterNumericFieldEditor and RadFilterTextFieldEditor

2 posts, 0 answers
  1. alpesh
    alpesh avatar
    2 posts
    Member since:
    Sep 2011

    Posted 02 May 2013 Link to this post


    I dont see the maxlength property on RadFilterNumericFieldEditor and RadFilterTextFieldEditor.
    Is there a way we can set the maxlength on these items?

  2. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 07 May 2013 Link to this post

    Hi Alpesh,

    I have assembled a sample project showing the desired functionality implemented. The idea is to loop through all RadNumericTextBox and TextBox controls in the RadFilter and set their MaxLenght property as shown below.
    protected override void OnPreRender(EventArgs e)
        List<Control> controls = new List<Control>();
        FindControlRecursive(this.RadFilter1, controls, typeof(TextBox));
        FindControlRecursive(this.RadFilter1, controls, typeof(RadNumericTextBox));
        foreach (Control control in controls)
            TextBox textBox = control as TextBox;
            RadNumericTextBox numeric = control as RadNumericTextBox;
            if (textBox != null)
                textBox.MaxLength = 2;
            else if (numeric != null)
                numeric.MaxLength = 2;
    public static void FindControlRecursive(Control container, List<Control> controls, Type type)
        if (container.GetType() == type)
        if (container.Controls.Count == 0)
        foreach (Control ctrl in container.Controls)
            FindControlRecursive(ctrl, controls, type);

    All the best,
    Antonio Stoilkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top