Note that there are some explanatory texts on larger screens.

plurals
  1. POI want the textbox AJAX Mask Edit Extender to change based on a radio button selection
    primarykey
    data
    text
    <p>I creating an ASP.net online application with C# background. I am also using AJAX MaskEditExtender. I'm pretty new to AJAX and don't know Javascript. What I need to do is have the textbox AJAX mask change based on the selection of the radio buttons. In this example they are choosing salary or hourly. I need the salary to be "999,999" and the hourly to be "99.99".</p> <pre><code>&lt;asp:TextBox ID="finalwage" runat="server" Width="80px"&gt;$&lt;/asp:TextBox&gt; &lt;!-- Salary Mask --&gt; &lt;asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="finalwage" Mask="999,999" MessageValidatorTip="true" MaskType="Number" InputDirection="RightToLeft" AcceptNegative="None" ErrorTooltipEnabled="true"&gt; &lt;/asp:MaskedEditExtender&gt; &lt;asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender1" IsValidEmpty="true" MinimumValue="0" MaximumValueMessage="Must enter a number" ControlToValidate="finalwage" &gt; &lt;/asp:MaskedEditValidator&gt; &lt;!-- Hourly Mask --&gt; &lt;asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="finalwage" Mask="99.99" MessageValidatorTip="true" MaskType="Number" InputDirection="RightToLeft" AcceptNegative="None" ErrorTooltipEnabled="true"&gt; &lt;/asp:MaskedEditExtender&gt; &lt;asp:MaskedEditValidator ID="MaskedEditValidator2" runat="server" ControlExtender="MaskedEditExtender1" IsValidEmpty="true" MinimumValue="0" MaximumValueMessage="Must enter a number" ControlToValidate="finalwage" &gt; &lt;/asp:MaskedEditValidator&gt; </code></pre> <p>.......</p> <pre><code>&lt;asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" RepeatDirection="Horizontal" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"&gt; &lt;asp:ListItem Text="Hourly" Value="Hourly" &lt;asp:ListItem Text="Salary" Value="Salary" /&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>Heres the C# code that I thought would work:</p> <pre><code>protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { if (RadioButtonList1.SelectedValue = "Hourly") { MaskedEditExtender1.Mask = "99.99"; } if (RadioButtonList1.SelectedValue == "Salary") { MaskedEditExtender1.Mask = "999,999"; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload