Masked Input Plugin jquery
<p>I am goting to use this <a href="http://digitalbush.com/projects/masked-input-plugin/" rel="nofollow">plugin</a> for an asp.net textbox.</p>

<p>The textbox is:</p>

<pre><code>   &lt;asp:TextBox ID="txtBox" runat="server" Text='&lt;%# Bind("Phone") %&gt;' /&gt;                 
</code></pre>

<p>I want the format is (999) 999-9999 when the textbox is non-empty. But it is null when the textbox is empty.</p>

<p>I want to select different mask by the text.
How is the code like?</p>

<p>I tried below:</p>

<p>Thanks.  </p>

<pre><code>  jQuery(function($){  
    if(document.getElementById("&lt;%# txtBox.ClientID %&gt;")).innerText =
       $("&lt;%# txtBox.ClientID %&gt;").mask("(999) 999-9999");  
    else
      $("&lt;%# txtBox.ClientID %&gt;").mask("");
  });
</code></pre>

<p><strong>UPDATE</strong></p>

<p>The textbox is inside a gridview. It likes:</p>

<pre><code>&lt;asp:TemplateField HeaderText="OrgContactPhone" SortExpression="OrgContactPhone"&gt;
            &lt;EditItemTemplate&gt;
                &lt;asp:TextBox ID="txtBox" runat="server" Text='&lt;%# Bind("OrgContactPhone") %&gt;' MaxLength="50"&gt;
                &lt;/asp:TextBox&gt;
</code></pre>
