RangeValidator未按预期工作

时间:2015-06-22 14:03:00

标签: asp.net .net

我有一个文本框,其中接受一个到期的金额作为字符串。我已将rangevalidator应用于该文本框,以便用户不会输入超过1000.00的任何内容。

以下是我的RangeValidator:

<Window x:Class="WpfApplication7.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <DataGrid Name="dgTest"></DataGrid>
    </Grid>
</Window>

点击提交按钮进行付款时,当我输入金额711.58时收到错误消息

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

试试这个:  

< asp:RangeValidator ID="rngPaymentAmount" runat="server" ControlToValidate="TextBox2" MaximumValue="1000.00" MinimumValue="5.00" Type="Double" SetFocusOnError="True" Display="Dynamic" meta:resourcekey="revPaymentAmountACHResource1" ErrorMessage="Values Should Be Between 5 and 1000" > < /asp:RangeValidator>

这对我来说可以!!对于5.00到1000.00之间的值不会给出任何错误。 祝你好运!!!