.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Calendar control - disable dates? (calendar extender)

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :ASP.Net

Hi there,

Does anyone know if it is possible to disable some of the dates available for selection.  For example, on opening the calendar all the dates before today are grayed out so that it is only possible to select dates in the future.

On my site I am using two calendar controls which are representing a start date of an event and an end date.  In the end date calendar I would like to disable all dates before the selected start date.

Is anything like this possible with the calendar control?

Thanks for your help,

View Complete Post

More Related Resource Links

Hiding other month dates in ASP .Net Calendar Control

Often we need ASP .Net calendar control in our webpages. Most of the times we require navigation in between dates of the calendar control but there can be a requirement that when we want that users should not be able to select dates from month other than the current month.Some people might be thinking in mind that Microsoft has provided theShowNextPrevMonth property of a calendar control which can be set to false in order to disable the navigation in between months. Ok, this will disable navigation but what about the dates of adjacent months shown in current month?Following is the output of a normal Calendar control when ShowNextPrevMonth is not set to false.Note the red circles in above image. July and September will allow you to navigate through other months and red circles below will allow you to select dates of adjacent months.Ok now we set the ShowNextPrevMonth property to false and see the output. Following is the output in this case.So setting out the ShowNextPrevMonth property has disabled the July and Septemberlinks but dates of adjacent months are still there which can be selected as well. How to disable/hide these? Unfortunately there is no such default property provided using which one can disable or hide these dates but fortunately doing this using code is not a complex task. Use following code a

Ajax Calendar Extender Question (about disable pass date)

HiI am wondering if it has anyway to disable the past day on the Ajax Calendar Control, previously, when we use CalendarExtender, we need to put a asp:Calendar and a textbox. we can use FindControl to find the calendar control and disable the past days.I am wondering is there anyway  could do the same stuff?Another question is how could I read the user selected date to the Date variable?Do i need to convert the date from the TargetControl ? E.g. Convert.ToDateTime(txt_DATE.text) ?Please let me know if you want me to explain more.Many thanksChi 

Ajax Calendar extender tool -How to disable cells?



I am using an Ajax Calendar Extender  tool in my application.I do wanna disable the past days calendar cells so that the user wont be able to click or select those cells .Can anybody help me ??


i wanna like.....
1. http://air.irctc.co.in



How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

Reuse a gridview within calendar control


Hello, I have a calendar control that will have events displayed within each cell.

I want to use a pre formatted gridview and simply bind the gridview with a dataset dynamically and display it within the cell of the specified day.

Is there a way to do that or do I have to dynamically build a gridview for every day that there is an event? 

So here is the template gridview and datasource:

 <asp:SqlDataSource ID="sqlcalitemtemp" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NNTrainingdbconnection %>" 
        SelectCommand="SELECT NN_Fire_Events.Start_Time, NN_Fire_Events.End_Time, tblNN_Fire_Cli

calendar extender


i want to put date into 2 combo box

combo1 = date, and combo2= month

can you help me?

MaterPage Ajax calendar extender not working


AJAX with MasterPage not working.

Setup simple test site below, no error just not working. TIA

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ajaxDev.WebForm1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  <asp:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" 
    Enabled="True" TargetCo

Stored Procedures & SqlDataAdapter not updating a calendar control


Hi all,

I have a database linked to a calendar. I had a peice of code that retrieved dates from a database and populated the calendar. I wanted to tidy up my code using stored procedures (they seem neater & i assume there's a benefit somewhere). so i came up with this, however it's not working. The calendar displays, but it's not being populated with the database entries. The SqlCommand & SqlParameter I have working elsewhere in my code; as with the SqlDataAdapter (which also worked before i tried to conver to a stored procedure!) but combining these three (SqlCommand, SqlParameter & SqlDataAdapter) seem to be causing me problems.

It's probably something stupid but if someone could take a look and point me in the right direction, I'd be very grateful.


Public Sub dbConnection()
        dbConnString = ConfigurationManager.ConnectionStrings("connString").ConnectionString
        sqlConn = New SqlConnection(dbConnString)
    End Sub

Public Sub EquipmentDDLSelection()

        Dim dbCMD As New SqlCommand("PopulateCalendar", sqlConn)
        dbCMD.CommandType = CommandType.StoredProcedure

        Dim parameterBookedEvents As New SqlParameter("@bookedEvents", SqlDbType.VarChar, 50)

calendar control, show onHover


hi all,
is it possible to have a calendar control on an asp.net page that is diplayed only onHover over some area?
Most of the times, the control won't be needed and I would like to save the space for something else. In case the calendar is needed I want it to slide down from under a link or button (most likely it will be an image there).

thanks a bunch,

Calendar control and date


I have a calendar control , text box and a button . The calendar is invisible in the page load event. When I click on the button,It becomes visible. On selection of a date it becomes the value of the Text Box.
Having said that, my issue is that when this calendar becomes visible, it ruins the arrrangement of the controls on the  page. As I have other controls on the page they  comepletely get displaced. Is there a way to overlap this calendar over the other controls.
I had seen a control that was  some time ago and it was on the client side(probably using javascript or a third party control ) and It wud overlap the other controls and once a value was selected it became invisible.

Applying custom CSS to the MOSS 2007 Calendar control Month view



I have a requirement to use the MOSS 2007 Calendar Control - month view is to apply a custom css to have a look and feel as per our requirements.

We tried applying the custom css to the MOSS 2007 calendar control - month view, it does take the custom css and applies it, but when i click on any date and come back to the calendar control, it changes the CSS of the MOSS calendar control back to the default one.

Let me know if anyone has any suggestion on  how to customize the calendar control for css for our intranet application.

Your response would be highly appreciated.






Problem with Ajax calendar extender visibility

sir i am using ajax calender extender in textbox below this textbox i am using a panel there is a gridview that show data.problem is when i click the textbox half of the calender id hiden behind the panel how to solve this problem. 

How to bind a calendar control to a datasource

In my application, user will enter some meeting dates in one page.   In the details page, they need to see those dates to make a selection for one file number. I want to show a calendar in the details page whice will show the dates already entered. To do that I need to bind the calendar to a datasource to get the information from the database. Please guide me to do that. Thanks in advance,

Is there a way to disable the day and week links within the Calendar itself?

I'm able to hide the top icons. I'm wondering if there's a way to keep a user from clicking the top of a date or the side of the week and navigating them to another calendar view. I only want to keep them within the month view. Thanks in advance! -Mike

Show Calendar Control SQL data value using Label control

Hi, I have a Calendar Control which is getting certain dates from SQL database and shows them in gray colour using following SQL statements: protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DateTime nextDate; if (dShows != null) { foreach (DataRow dr in dShows.Tables[0].Rows) { nextDate = (DateTime)dr["Date"]; if (nextDate == e.Day.Date) { e.Cell.BackColor = System.Drawing.Color.DarkGray; } } }  SELECT Count(Mytable.ID), Mytable.Date,MAX(Location.SLocation) as Location FROM Mytable INNER JOIN Location ON Mytable.Sh_ID=Location.Sh_ID GROUP BY Mytable.Date Everything works fine but I want to Show Location and Date also under the calendar control usnig Label control so when user clicks highlighted date it shows Date and Location (only the ones which are coming from SQL database and are highlighted) using Label control. Thank you.      

Problem displaying Date from Sql table on Calendar Control

Hi, I am displaying Event dates from SQL table on Calendar Control in ASP.NET. Also, I have GridView Control which shows event details when certain date is clicked on calendar control. But I have a problem as not all dates are displaying properly. Strangly enough only dates which have same month and day date are displayed. For example: It shows ok dates such as 08/08/2010, 09/09/2010, 10/10/2010 etc. If I click on the date which in SQL table exists as 11/25/2010 or 12/15/2010 etc (no matching month/day numbers) it shows error message saying: "System.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string."  Follwoing is my code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Runtime.Remoting.Messaging; using System.Configuration; using System.Data.SqlClient; using System.Data; using System.Drawing; public partial class Test_Calendar : System.Web.UI.Page { SqlConnection mycn; SqlDataAdapter myda; DataSet ds = new DataSet(); DataSet dsSelDate; String strConn; private void Page_Load(object sender, System.EventArgs e) { strConn = "Data Source=mydatasource;Initial Catalog=DBname;Persist Security I
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend