脚踏祥云

导航

发表日期不能大于当前时间----验证

<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtPublishDate"
                    ErrorMessage="RangeValidator" MinimumValue="1900-01-01" Type="Date">发表日期不能大于当前时间</asp:RangeValidator>

-----上面是前台代码

-----下面是后台代码

 protected void Page_Load(object sender, EventArgs e)
    {
        this.RangeValidator1.MaximumValue = DateTime.Now.ToShortDateString();
        .......

    }

posted on 2012-03-30 10:44  脚踏祥云  阅读(231)  评论(0编辑  收藏  举报