Search code examples
c#asp.netasp.net-ajaxmaskedtextbox

Masked Edit Extender: custom mask for e-mail textbox, is there any way to restrict the user to a specific domain with a custom mask?


I have a register page for the user, but it should only allow the user to enter one specific domain for their email, like this:

*@example.com

The username for the email can be anything, but the domain must be pre-typed and cannot change. I'm trying to do it with Ajax Masked Edit Extender but I can't find a way to make the domain a static value like I want.

How do I achieve this?


Solution

  • Try this code:

        <asp:TextBox ID="txtemail" runat="server"></asp:TextBox>
        <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" Mask="[email protected]"
            InputDirection="LeftToRight" TargetControlID="txtemail">
        </cc1:MaskedEditExtender>
    

    In mask property in place of AAAAAA you want add more AAA it's depend on your requiredment how much character to allow user to enterde.

    OR

    you have put like this option in textbox user can enter only character whatever you pass in mask property.

    Like Below Image:

    Mask

    http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask(v=vs.90).aspxMaskedTextBox