Post by Admin on Sept 4, 2015 12:12:04 GMT
Recently I faced some issue in ajaxToolkit:FilteredTextBoxExtender. I want to enter the numeric value as 999.99 format. So the code looks like
But it didn't accept the dot. So I changed it like
Now the problem start. In my PC it works perfect. After deployment to live serve, I checked it in client's PC which is in German Culture (DE). Now I seen some unnatural behavior, sometime it didn't save the decimal place at all. Means I entered like 9.99, after saving I found it save 999. And there is another problem which is not relevant with this post, but for information in German Culture they enter decimal place as comma (,) also.
After a little try changed it like follows.
Note: I didn't take care the comma as decimal place. I think you can easily change it........
Enjoy coding.....................
<asp:TextBox ID="txtValue" runat="server" MaxLength="250" CssClass="textbox severtyValue" Width="210"></asp:TextBox>
<ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" TargetControlID="txtValue"
FilterType="Numbers" runat="server">
</ajaxToolkit:FilteredTextBoxExtender>
But it didn't accept the dot. So I changed it like
<asp:TextBox ID="txtValue" runat="server" MaxLength="250" CssClass="textbox severtyValue" Width="210"></asp:TextBox>
<ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" TargetControlID="txtValue"
FilterType="Numbers, Custom" ValidChars="." runat="server">
</ajaxToolkit:FilteredTextBoxExtender>
Now the problem start. In my PC it works perfect. After deployment to live serve, I checked it in client's PC which is in German Culture (DE). Now I seen some unnatural behavior, sometime it didn't save the decimal place at all. Means I entered like 9.99, after saving I found it save 999. And there is another problem which is not relevant with this post, but for information in German Culture they enter decimal place as comma (,) also.
After a little try changed it like follows.
<asp:TextBox ID="txtValue" runat="server" MaxLength="250" CssClass="textbox myvalue" Width="210" onblur="$('.myvalue').val(parseFloat($('.myvalue').val()).toFixed(5));"></asp:TextBox>
<ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" TargetControlID="txtValue"
FilterType="Custom" ValidChars="1234567890." runat="server">
</ajaxToolkit:FilteredTextBoxExtender>
Note: I didn't take care the comma as decimal place. I think you can easily change it........
Enjoy coding.....................