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.
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)
{
controls.Add(container);
}
if (container.Controls.Count == 0)
{
return;
}
foreach (Control ctrl in container.Controls)
{
FindControlRecursive(ctrl, controls, type);
}
return;
}
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.