问题描述
大家好,
我遇到了一个小问题。我想将用户输入的数据格式化为用逗号分隔的文本框。
Ex:12,345.00而不是12345。它还应包含小数部分。
我尝试使用ajax蒙面编辑扩展程序,但我的客户端不舒服,因为它在输入时显示逗号和点。
我正在寻找简单的客户端格式,因为我有很多文本框。用户输入数据后,格式应如上所述进行更改。我使用ajax扩展程序附加我的代码,虽然它可能无法解决我的问题。请帮我。在此先感谢:)
Hello all,
I am stuck with a trivial problem. I want to format data entered by user into text boxes separated with comma.
Ex : 12,345.00 instead of 12345 . It should also contain the decimal part.
I tried with ajax masked edit extender but my client is not comfortable as it shows commas and dots while typing.
I am looking for easy client side formatting as I have many text boxes. Once user enters data , format should change as above. I am attaching my code using ajax extender though it may not help with my problem. Please help me. Thanks in advance :)
<asp:TextBox
ID="tbcommunications" runat="server"
style="margin-left: 0px; margin-bottom: 0px;" Height="100%" Width="80%" CssClass="style22" TabIndex="16" Font-Names="Trebuchet MS" Font-Size="Small"></asp:TextBox><asp:MaskedEditExtender ID="MaskedEditExtender14" runat="server" TargetControlID="tbcommunications"
Mask="9,999,999.99"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Number"
InputDirection="RightToLeft"
AcceptNegative="Left"
DisplayMoney="Left"
ErrorTooltipEnabled="True">
</asp:MaskedEditExtender>
推荐答案
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender8" runat="server" FilterType="Numbers, Custom"
ValidChars=".," TargetControlID="TextBox8" />
这篇关于带逗号的自动格式文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!