Properties of Required field validations for Dropdown
list is bit different from textbox.
Following are the properties need to be set in Dropdown list
and for Required Field Validator.
<asp:CompareValidator ID="CompareValidator2" runat="server"
ErrorMessage="Same as
mobile" Display="Dynamic" SetFocusOnError="True"
ForeColor="Red" ValidationGroup="sub" ControlToValidate="txt_alt_no"
ControlToCompare="txt_mob_no" Operator="NotEqual"></asp:CompareValidator>
Terms Used:
ErrorMessage:
Message to be displayed to show error.
SetFocusOnError:
So that cursor
remains on the textbox which has error.
ValidationGroup: It should be same
as validation of button on whose click event action on the textbox
will be take.
ControlToValidate: Name of Textbox on
which validation is to be
applied.
ForeColor: Color in which
error is displayed.
ControlToCompare:
Name of Textbox from which it has to compare.
Operator: Compare operator(compairing for greater than
/equivalent/smaller than).
Summary
In this article I try to expose the Compare Field Validation. I hope after reading this article you will be able to use this trick in your code. I would like to have feedback from my blog readers. Please post your feedback, question, or comments about this article.
No comments:
Post a Comment