Problem using MaskedEditExtender "Any Character" (?) Mask Character

Last post 07-02-2009 5:01 PM by bc_chicago. 1 replies.

Sort Posts:

  • Problem using MaskedEditExtender "Any Character" (?) Mask Character

    07-02-2009, 1:12 PM
    • Member
      point Member
    • bc_chicago
    • Member since 07-02-2009, 12:44 PM
    • Posts 2

    I have run into a problem using the MaskedEditExtender and have not seen this same issue anywhere else on the internet after searching.

    I am trying to use a MaskedEditExtender on a TextBox.  The Maks is “99-999-99-??9999”.  The issue is with the “Any Charcter” Masked Charactes (the 2 question marks).  Here is the issue I am having:

    1. I enter 13 characters in the “TextBox1” textbox.  For example:  11-111-11-AA1111
    2. I click outside of the “TextBox1” textbox, so that it looses focus.
    3. I click back inside the “TextBox1” textbox again.  When I do the value inside the textbox is now:  11-111-11--A1111.  Notice that the first letter “A” in the texbox is now a dash.
    4. I then click outside of the “TextBox1” textbox again, so that it looses focus.
    5. Nex t I click inside the “TextBox1” textbox again.  When I do the value inside the textbox is now:  11-111-11---1111.  Now the second letter “A” in the textbox is also a dash.

    I have a lot of code in the page.  Here are the highlights:

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

    <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1" Mask="99-999-99-??9999" ClearMaskOnLostFocus="false"></cc1:MaskedEditExtender>

    <asp:TextBox ID="TextBox1" runat="server" Enabled="false"></asp:TextBox>

     

    Does anyone have a solution for this problem?

    Thanks!

  • Re: Problem using MaskedEditExtender "Any Character" (?) Mask Character

    07-02-2009, 5:01 PM
    Answer
    • Member
      point Member
    • bc_chicago
    • Member since 07-02-2009, 12:44 PM
    • Posts 2

    I found a work-around to the problem, but still no solution.

    I replaced the “?” Masked Character with a “C”.  The “C” is a custom character.  You have to specify all the valid characters for mask type "C" in the Filtered property of the MaskedEditExtender.  One item of note, the Filtered property is case-sensitive.

    Here is the code:

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

    <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtFoodStampTANF" Mask="99-999-99-CC9999" Filtered="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ClearMaskOnLostFocus="false"> </cc1:MaskedEditExtender>

    <asp:TextBox runat="server" Enabled="false"></asp:TextBox>

Page 1 of 1 (2 items)