Version

Configuring And Retrieving Input Masks Dynamically

Topic Overview

Purpose

This topic demonstrates how to get and set the WebMaskEdito r™ input masks dynamically.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic introduces the WebMaskEditor control and its features.

This topic demonstrates the meaning of the symbols that you need in order to create WebMaskEditor mask.

Configuring Input Masks Summary

Configuring Input Masks summary chart

The following table lists the configurable aspects of the WebMaskEditor control:

Configurable aspects Details Properties and Methods

1 .Set the WebMaskEditor mask on Server-side

2*.* Get the WebMaskEditor mask on Server-side

The InputMask property is the one that needs to be used for setting and getting the WebMaskEditor ’s masks.

1 .Set the WebMaskEditor mask on Client-side

2*.* Get the WebMaskEditor mask on Client-side

The WebMaskEditor exposes two client-side methods for setting and getting the WebMaskEditor masks.

Get and Set WebMaskEditor the Input Masks on the Server

Overview

In order to get or set the WebMaskEditor mask on the server, you simply need to get or set the control property called ` InputMask`.

Example for Setting Mask

The code below demonstrates how to set the WebMaskEditor input mask on the server using the markup or code-behind:

In ASPX:

<ig:WebMaskEditor ID="WebMaskEditor1” runat="server"
InputMask="###-##-####"/>

In C#:

this.WebMaskEditor1.InputMask = "###-##-####";

Example for Getting Mask

The code below demonstrates how to get the WebMaskEditor input mask on the server:

In C#:

string inputMask = this.phoneEditor.InputMask;

Get and Set WebMaskEditor Input Masks on the Client

Overview

The WebMaskEditor client-side object model proposes two methods for getting and setting the input mask. They are ` get_inputMask()` and ` set_inputMask()`. In a scenario when you need to change the mask dynamically, this will save you from having to make a request to the server in order to configure the WebMaskEditor .

Example for Setting Mask

The code below demonstrates how the ` set_inputMask()` method is used to set the WebMaskEditor input mask dynamically on the client:

In JavaScript:

$find("<%= this.WebMaskEditor1.ClientID %>").set_inputMask(“###-##-####”);

Example for Getting Mask

The code below demonstrates how the ` get_inputMask()` method is used to get the WebMaskEditor input mask dynamically on the client:

In JavaScript:

var mask = $find("<%= this.WebMaskEditor1.ClientID %>").get_inputMask();

Related Content

Topics

The following topics provide additional information related to this topic:

Topic Purpose

This topic introduces the WebMaskEditor control and its features.

This topic demonstrates the meaning of the symbols that you need to create WebMaskEditor mask.

Samples

The following samples provide additional information related to this topic:

Sample Purpose

This sample demonstrates how to dynamically change the input mask of WebMaskEditor control using its client API.