验证中...
Languages: ASP
Categories: Web开发技术
Latest update 2018-12-28 09:41
CompareValidator控件
Raw Copy
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="输入大于0的值" ForeColor="Red" Operator="GreaterThanEqual" Type="Double" ValueToCompare="0"></asp:CompareValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="submit" />
</div>
RangeValidator控件
Raw Copy
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="输入1到10之间的数" ForeColor="Red" MaximumValue="10" MinimumValue="1" Type="Double"></asp:RangeValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="submit" />
</div>
RequiredFieldValidator控件
Raw Copy
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="不能为空" ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="submit" />
</div>
Web.config配置文件
Raw Copy
<!--添加以下配置,当出现WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptResourceMapping。-->
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025