How to disable Previous dates in AjaxControlToolkit CalendarExtender control in ASP.Net

Introduction:

In this article I am going to explain how to disable the previous dates in AjaxControl Toolkit CalendarExtender control.

Prerequisites:

This example needs AjaxControlToolkit’s to be installed in your machine. I have explained the procedure to install AjaxControlToolkit in my previous article.

Implementation

HTML:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
        <asp:TextBox ID="txtCalendar" runat="server"></asp:TextBox>
        <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtCalendar"></asp:CalendarExtender>
    </form>
</body>
</html>

C#:

protected void Page_Load(object sender, EventArgs e)
{
      //To Disable the Previous Dates in CalendarExtender control
      CalendarExtender1.StartDate = DateTime.Now; 
}
Advertisements

, , , , ,

  1. Leave a comment

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