RadMaskedTextBox Fixed Mask

2 posts, 1 answers
  1. Yazan
    Yazan avatar
    5 posts
    Member since:
    Nov 2011

    Posted 19 Nov 2012 Link to this post

    Hi,
    I have a radmaskedtextbox that is intended for gender-input. the desired mask should accept only one of the following inputs: "m", "f", "M", "F", or "" (the empty ("") is obviously necessary to wait for the user to input the gender)

    That's it, I can't discover the mask that should provided in the mask property.

    Thank you for your help.
  2. Answer
    Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 22 Nov 2012 Link to this post

    Hello Yazan,

    A possible approach is to build up a mask using the MaskParts property at runtime. Check out the following code snippet.
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            EnumerationMaskPart enumPart = new EnumerationMaskPart();
            enumPart.Items.Add("M");
            enumPart.Items.Add("m");
            enumPart.Items.Add("F");
            enumPart.Items.Add("f");
            enumPart.Items.Add("");
            RadMaskedTextBox1.MaskParts.Add(enumPart);
        }
    }


    Kind regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top