开发者

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();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜