日历最小日期 [英] Calendar Min Date

查看:150
本文介绍了日历最小日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中设置日历的最小日期?



i在标签控件中有日期...



我希望日期是日历的最短日期....



这意味着没有人可以在日期之前选择日期日期显示在该日历的标签上....







请帮帮我


Kishore R

Gis Solutions

how can we set min date for a calendar in asp.net?

i have a date in a label control...

I want that date is the min date of a calendar....

that means no one can select a date before the date shown in the label from that calendar....



Please help me

Kishore R
Gis Solutions

推荐答案

kishore Rajendran写道:
kishore Rajendran wrote:

没有人可以在该日历标签中显示的日期之前选择日期

no one can select a date before the date shown in the label from that calendar





如果您使用的日历控件支持设置最小日期,则使用该属性执行或者其他..

使用JavaScript ...并且每当选择日期时,请使用标签检查设置前的最短日期。



或者,你也可以在渲染日历控件之前禁用标签日期之前的所有日期。



If the calendar control you are using gives support of setting minimum date then do it using that property OR else..
Use JavaScript... and whenever a date is selected, check that with the label minimum date before setting it.

Alternatively, you can also disable all the dates before that label date before rendering the calendar control.


protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToString();
    }
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (Label1.Text != "")
        {
            if (e.Day.Date < Convert.ToDateTime(Label1.Text))
            {
                e.Day.IsSelectable = false;
            }
        }
    }


这篇关于日历最小日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆