Validation Summary control ASP.NET program output error?
I am executing this validation summary program in Visual web developer 2008 express edition, found the validation summary property is not visible in output. please help me sort out this problem!! Thanks in advance
<div><asp:ValidationSummary ID="sum1" runat ="server" ShowMessageBox="false" HeaderText="You details cannot be processed due to following errors:" DisplayMode="BulletList" ShowSummary ="true" Font-Names ="arial" Font-Size ="12"></asp:ValidationSummary>
<asp:CompareValidator ID="cmp1" runat ="server" ControlToValidate ="txtname" Display="Dynamic" Operator="DataTypeCheck" ControlToCompare="txtname1" Type="String" ErrorMessage="values does not match" >*</asp:CompareValidator>
<asp:RangeValidator ID="ran1" runat ="server" ControlToValidate ="txtda开发者_开发知识库te" MinimumValue="01/08/2011" MaximumValue="31/08/2011" Type="Date" Display="Dynamic" ErrorMessage="Enter date between 1/8/2011 to 31/8/2011" >*</asp:RangeValidator>
<asp:CompareValidator id="cmp" runat ="server" ControlToValidate ="txtdate" Operator="DataTypeCheck" Type="Date" Display="Dynamic" ErrorMessage="You must date is format of dd/mm/yyyy" >*</asp:CompareValidator>
The problem you are experiencing (at least with the first compare validator) is that you are performing a DataTypeCheck (Type="DataTypeCheck").
Thich means the validator is only validating the datatype of txtname which in this case is specified as String (Type="String") and not comparing it to txtname1.
If you need to check the value in txtname is equal to txtname1 you should use the Equal operator.
CompareValidator.Operator Property
See "DataTypeCheck" under the "Remarks" section.
精彩评论