RadInput for ASP.NET

Free Mask Part Send comments on this topic.

Glossary Item Box

 

Class

 Description

Telerik.WebControls.DigitMaskPart

This class is used to restrict the user input to digit characters only. In the code it is declared in the mask string as #.

Telerik.WebControls.EnumerationMaskPart

 

 

 

 

 

The RadMaskedTextBox has a property named AllowEmptyEnumerations which determines if the user can set the value of the part to empty string by deleting. In code-behind it is declared in the mask string as <Option1|Option2|Option3>
The pipe serves as a separator between the option values. Restricts the user input to one of the set options.

 

Example

The screenshot and the extract of the the source code below how to add enumeration part to a RadMaskedTextBox.

 

private void Button1_Click(object sender, System.EventArgs e)
{//RadMaskedTextBox1.MaskParts.Add( new DigitMaskPart());
 //Label1.Text = "#";
 EnumerationMaskPart enumPart = new EnumerationMaskPart();
 string[] enumValues = Regex.Split(TextBox1.Text, "\r\n");
   foreach (string enumValue in enumValues)
   {
     enumPart.Items.Add(enumValue);
   }
     RadMaskedTextBox1.MaskParts.Add(enumPart);
}

 

 Telerik.WebControls.FreeMaskPart

In order not to restrict the user input, you should use FreeMaskPart. In the code it is declared in the mask string as a.

 Telerik.WebControls.LiteralMaskPart

Any symbol in the mask, which is not recognized as a mask part description or is escaped with backslash, is treated as a literal mask part. When together, the literal characters are treated as one mask part a, for example --- will be parsed to a single literal mask part, containing a 3 character. The user may type the exact character of the literal, otherwise its input is thrown to the next mask part.
 Telerik.WebControls.UpperMaskPart

This class is used to restrict the user input to alphabetical characters only. Any character typed is converted to upper case.

 Telerik.WebControls.LowerMaskPart

Restricts the user input to alphabetical characters only. Any character typed is converted to lower case. In code-behind it is declared in the mask string as l.

 Telerik.WebControls.NumericRangeMaskPart

This class is used to restricts the user input to the declared numeric range. The numeric range mask part may occupy multiple characters of the mask.

In code-behind it is declared in the mask string as <1..99>.
The first number is the lowest possible value the part can handle. The second one is the highest.