Set mask from cs

2 posts, 0 answers
  1. Katya
    Katya avatar
    21 posts
    Member since:
    May 2013

    Posted 02 Jul 2013 Link to this post

    Hi

    How can I set the mask of radmaskedtextbox from cs?

    Thanks for replying
    Katya
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jul 2013 Link to this post

    Hi,

    At run time, you can set the mask in the following ways:

    C#:
    RadMaskedTextBox1.Mask = "(###) ### - ####";

    Then another method is Build up a mask using the MaskParts property:

    C#:
    EnumerationMaskPart enumPart = new EnumerationMaskPart();
    enumPart.Items.Add("Mon");
    enumPart.Items.Add("Tue");
    enumPart.Items.Add("Wed");
    enumPart.Items.Add("Thu");
    enumPart.Items.Add("Fri");
    enumPart.Items.Add("Sat");
    enumPart.Items.Add("Sun");
    RadMaskedTextBox1.MaskParts.Add(enumPart);
    LiteralMaskPart literalPart = new LiteralMaskPart();
    literalPart.Text = " ";
    RadMaskedTextBox1.MaskParts.Add(literalPart);
    RadMaskedTextBox1.MaskParts.Add(new DigitMaskPart());

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top