This is a migrated thread and some comments may be shown as answers.

Problem with emphasis

1 Answer 45 Views
Input
This is a migrated thread and some comments may be shown as answers.
ericc34
Top achievements
Rank 1
ericc34 asked on 20 May 2011, 12:45 PM
I have an radmaskedtextbox in my page and i want only character from a to z and A to Z without é, è, etc.

How I can do this ?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 May 2011, 02:31 PM
Hello Eric,

There is no easy way to create such mask. You have to list all possible symbols one by one. Sample code is shown below:
<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" AllowEmptyEnumerations="true">
</telerik:RadMaskedTextBox>

protected void Page_Load(object sender, EventArgs e)
{
    uint maxCharacters = 10;
    RadMaskedTextBox1.Mask = GenerateCustomMask(maxCharacters);
}
 
private string GenerateCustomMask(uint maxCharacters)
{
    uint startChar = '0';
    uint endChar = 'z';
    string outMask = "";
    StringBuilder mask = new StringBuilder();
    mask.Append("<");
    for (uint i = startChar; i <= endChar; i++)
    {
        if (Char.IsLetterOrDigit((char)i))
            mask.Append((char)i);
        else continue;
        if (i < endChar)
            mask.Append("|");
        else
            mask.Append(">");
    }
    for (uint i = 0; i < maxCharacters; i++)
        outMask += mask.ToString();
    return outMask;
}

Note that you may have a noticeable performance degradation on the client if you have too much symbols.

Regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Input
Asked by
ericc34
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or