First
Imports System.ComponentModel
Then
Dim MaskPhone As New MaskedTextProvider("0000-0000")
So when the value it will come up with mask
When typing you can use that to my JS would be the simplest solution.
In Source you add the event "onKeyUp"
Exemple:
<asp:TextBox ID="TextBoxPHONE" runat="server" CssClass="textbox" Width="65px" onKeyUp="Mascara('PHONE',this,event);" MaxLength="10" TabIndex="31" ></asp:TextBox></td>
And the following function:
if (key! key = 9 &&! = 8) {
switch (type) {
case 'PHONE':
if (tam> = 5 && tam <9)
campo.value s.substr = (0, 4) + '-' + s.substr (4, 4);
if (tam> = 6 && tam == 10)
campo.value s.substr = (0, 5) + '-' + s.substr (5, 4);
break;
}
}