Question:
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
<asp:TextBox ID="txt1" runat="server" />
<asp:TextBox ID="txt2" runat="server" />
You need to ensure that the value of txt2 is greater than the value of txt1 before the page is submitted to the server. Which code fragment should you use?
A
<asp:CompareValidator id="CompareValidator1"
ControlToValidate="txt2"
ErrorMessage="txt2 not bigger than txt1" Text="*"
ControlToCompare="txt1" Operator="GreaterThanEqual"
Type="Integer" Runat="Server" />
B
<asp:CompareValidator id="CompareValidator1"
ControlToValidate="txt2"
ErrorMessage="txt2 not bigger than txt1" Text="*"
ControlToCompare="txt1" Operator="GreaterThan"
Type="Integer" Runat="Server" />
C
<asp:RangeValidator id="RangeValidator1"
ControlToValidate="txt1"
ErrorMessage="txt2 not bigger than txt1" Text="*"
ControlToCompare="txt2" MinimumValue="0" MaximumValue="txt2" Type="Integer" Runat="Server" />
D
<asp:RangeValidator id="RangeValidator1"
ControlToValidate="txt2"
ErrorMessage="txt2 not bigger than txt1" Text="*"
ControlToCompare="txt1" MinimumValue="0" MaximumValue="txt2" Type="Integer" Runat="Server" />
+ AnswerB
+ Report