Home > ASP.Net > Disable Dates in a Calendar

Disable Dates in a Calendar


Hi

try this example to disable user to select Today and any date greater than Today date

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date< DateTime.Today)
{
e.Day.IsSelectable = false;
e.Cell.ToolTip = "This date is not available";
}
else if (e.Day.Date> DateTime.Today)
{
e.Day.IsSelectable = false;
e.Cell.ToolTip = "This date is not available";
}
}

Good Luck

Advertisements
Categories: ASP.Net
  1. Avinash
    May 4, 2009 at 9:30 am

    How to achive this with Ajaxtoolkit calender!!! any idea….

    Thank you

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: