AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How can I enable a specific colum in calendar control
Posted by jafar sadique on  2/14/2009 12:05:15 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
I want to enable only one day of week of a calendar control at the time of page load depending on a fixed day from previous page by Session. I use C# for coding.

Post Your Reply Post New Question

 Viewer's Reply
How can I enable a specific colum in calendar control
Answered By Kunwar on 3/4/2009 4:35:12 AM
I am assuming Day as weekdays i.e. Monday,Tuesday...Sunday

To enable any given Day you can use Day_Render method as given here:-

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if(e.Day.Date.DayOfWeek == DayOfWeek.Monday)
{

}
else
{
e.Day.IsSelectable = false;
}
}
 
Try like this,
Answered By Moderator1 on 4/2/2009 4:57:08 AM
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (Session["EnableDate"] == null) return;
if (!(e.Day.DayNumberText == Session["EnableDate"].ToString()))
{
e.Day.IsSelectable = false;
}
}
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Website Magazine
Simply SQL - Free 111 Page Preview!
Introduction to Software Development