protected void Page_Load(object sender, EventArgs e)
{
Calendar1.StartDate = DateTime.Now; //to dissable past Date
}
In the above code I have set the Calendar Extender start date to the current date so I will disable all past dates.
Now run the application; the output will look as in the following:
To disable a future date use the following code in the "Page load":
protected void Page_Load(object sender, EventArgs e){
Calendar1.EndDate = DateTime.Now; //to dissable future Date
}
In the above code I have set the Calendar Extender End date to the current date so I will disable all future dates.
Now run the application; the output will look as in the following:
Start Calendar after one month from the Present Date
protected void Page_Load(object sender, EventArgs e)
{
Calendar1.EndDate = DateTime.Now.AddMonths(1); // Start Calendar after one month from Present Date
}
Note
For detailed code please download the Zip file.
Summary
I hope this article is useful for all readers and also I hope developers will follow this technique to avoid a hundred lines of code to do this, if you have any suggestion then please contact me.