Problem with emphasis

2 posts, 0 answers
  1. ericc34
    ericc34 avatar
    91 posts
    Member since:
    Jul 2006

    Posted 20 May 2011 Link to this post

    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 ?
  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 26 May 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top