Phone number displayed incorrectly in ajax control instrumentation masks?

I have a phone number 866-234-5678.

I have an asp textbox and I am applying the following mask:

 <cc2:MaskedEditExtender ID="maskPhone" 
                         runat="server" 
                         ClearMaskOnLostFocus="false"
                         AutoComplete="false" 
                         MaskType="None" 
                         Mask="(999)-999-9999" 
                         InputDirection="LeftToRight"
                         TargetControlID="txtPhone">
 </cc2:MaskedEditExtender>

      

When I load a page with a text box, the phone number is displayed like this:

(662) -345-678 _

0


a source to share


3 answers


The mask contains 4 digits for the last group. The underlined "_" character appears as a PromptCharacter from MaskedEditExtender.



+1


a source


When you set the .Text property to page_load, the code behind is set to rendered <INPUT

and then Mask Applied with Javascript after the page finishes rendering in the browser. Since the first character ( 8

) is not part of the mask as that point, the javascript for the expander seems to overwrite it with the first brace of the (

mask. This is strange behavior, but completely reproducible.

If you change your code to



tbxPhone.Text = " 8662345678";

      

Seems to fix this since the filled space is the one that's truncated, but this one is damn ugly. It's probably best to register a ticket with the developers on CodePlex, or take a hit at fixing the expander yourself if you feel it :)

0


a source


I had this problem too, only my (525) 234-5678 showed up as (_25) 234-5678. Left padding with an extra character before binding the value to the TextBox cleared it. Stupid ...

0


a source







All Articles