Ajax Calendar validations
In my web application I have taken a ajax calendar in that i want to restrict the user to select future date, when user select future date should开发者_JAVA技巧 raise the error
Use compare validator and set its type to Date
<asp:CompareValidator ID="cmp" ControlToValidate="TextBox1" runat="server" ErrorMessage="CompareValidator"
Operator="LessThanEqual" Type="Date"></asp:CompareValidator>
In the codebehind set ValuetoCompare like.
if (!Page.IsPostBack)
{
cmp.ValueToCompare = DateTime.Today.ToShortDateString();
}
精彩评论