如何仅在日历工具箱中显示当前日期和未来日期? [英] How to display the current date and future dates only in calendar toolbox ?

查看:78
本文介绍了如何仅在日历工具箱中显示当前日期和未来日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友



我想知道Asp.net中日历工具的功能,只在我预订日期时显示当前日期和未来日期酒店应用程序如此指导我如何运作?我要用AJAX吗?







谢谢

Hello Friends

I want to know the function of Calendar tool in Asp.net to display the current date and future dates only while am booking the date in my hotel application so guide me how to function this ? Shall I do this in AJAX ?



Thanks

推荐答案

你可以按照自己的意愿去做。它可以在asp.net日历工具中完成,也可以使用ajax日历。

在asp.net日历工具中执行以下操作:

aspx code

You may do it as you want to. It can be done in asp.net calender tool as well as using ajax calender as well.
In asp.net calender tool do as following:
aspx code
<asp:Calendar ID="Calendar1" runat="server" OnDayRender="Calendar1_DayRender"></asp:Calendar>



aspx。 cs代码或代码背后


aspx.cs code or code behind

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
         if (e.Day.Date < DateTime.Now.Date)
        {
            e.Day.IsSelectable = false;
            e.Cell.ForeColor = System.Drawing.Color.Gray;
        }
    }





虽然这是在这种情况下使用的简单代码。您可以查看下面提到的链接进行设计

如何从日历控件中动态禁用所选日期 [ ^ ]

how-to-disable-calendar-past-previous.html [ ^ ]



如果您想使用ajax日历,请查看此链接

AJAX-CalendarExtender-Disable-Past-Date-Selection.aspx [ ^ ]



希望它有效。 :)

Happy Coding !!



although it is the simple code used in this case. You may check out below mentioned links for designing
How to Disable Selected Dates dynamically from the Calendar Control[^]
how-to-disable-calendar-past-previous.html[^]

and in case you want to use ajax calender check out this link
AJAX-CalendarExtender-Disable-Past-Date-Selection.aspx[^]

Hope it works. :)
Happy Coding!!


这篇关于如何仅在日历工具箱中显示当前日期和未来日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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