Create new account I forgot my password    

ASP.NET AJAX Calendar Extender – Tips and Tricks
Rating: 127 user(s) have rated this article Average rating: 4.5
Posted by: Suprotim Agarwal, on 5/2/2008, in category "ASP.NET AJAX"
Views: this article has been read 193253 times
Abstract: The CalendarExtender is an ASP.NET AJAX control that is associated with a TextBox control. When the user clicks on the TextBox, a client-side Calendar control pops up. The user can then set a date by clicking on a day, navigate months by clicking on the left and right arrow and perform other such actions without a postback. In this article, we will see some tips and tricks that can be applied to a CalendarExtender control.

ASP.NET AJAX Calendar Extender – Tips and Tricks
 
The CalendarExtender is an ASP.NET AJAX control that is associated with a TextBox control. When the user clicks on the TextBox, a client-side Calendar control pops up. The user can then set a date by clicking on a day, navigate months by clicking on the left and right arrow and perform other such actions without a postback. In this article, we will see some tips and tricks that can be applied to a CalendarExtender control. If you are new to the CalendarExtender control, you can check out some information about it over here.
I assume you have some basic experience developing ASP.NET Ajax applications and have installed the ASP.NET Ajax Library and ASP.NET Control Toolkit. As of this writing, the toolkit version is Version 1.0.20229 (if you are targeting Framework 2.0, ASP.NET AJAX 1.0 and Visual Studio 2005) and Version 3.0.20229 (if targeting .NET Framework 3.5 and Visual Studio 2008).
All the tips shown below have been created using Version 3.0.20229 (targeting .NET Framework 3.5 and Visual Studio 2008).
Tip 1: How to display and hide a Calendar on the click of a Button
If you want to popup a Calendar on the click of a button, you can use set the PopupButtonID of the CalendarExtender to the ID of the button. In this case, we will be using an ImageButton as shown below:
       <asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/Images/Icon1.jpg" AlternateText="Click here to display calendar" />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       
        <cc1:CalendarExtender ID="CalendarExtender1" runat="server"
        TargetControlID="TextBox1" PopupButtonID="ImageButton1"/>
If you are using an earlier version of the toolkit, you may observe that the ImageButton causes a postback when you click on it again, to close the Calendar. To avoid the postback, use a HTML Image Control instead of the Server side Image Control as shown below:
       <img alt="Icon" src="/Images/Icon1.jpg" id="Image1" />
       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       
        <cc1:CalendarExtender ID="CalendarExtender1" runat="server"
        TargetControlID="TextBox1" PopupButtonID="Image1"/>
Note: In case you are clicking on the textbox to open the calendar, then in earlier versions of the toolkit, the calendar would not hide automatically when the user clicked anywhere outside the Calendar control. However this was fixed in the later versions. In fact, in the latest version, the Calendar hides automatically when a date is selected.
If for some reason you are facing issues with the Calendar not hiding automatically, make sure that you have the latest version of the AJAX Control Toolkit.
Tip 2: How to Add a CalendarExtender to a GridView
If you want to add a CalendarExtender to a GridView, use a template field with a TextBox and CalendarExtender as shown below:
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
            DataSourceID="SqlDataSource1" ShowFooter="true" AllowPaging="True" AllowSorting="True">
            <Columns>           
               <asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
                 SortExpression="CategoryID" />
                  <asp:BoundField DataField="CategoryName" HeaderText="CategoryName"
                 SortExpression="CategoryName" />
              <asp:TemplateField>
                <ItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"/>
                </ItemTemplate>
            </asp:TemplateField>               
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=SUPROTIM;Initial Catalog=Northwind;Integrated Security=True"
            SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]" >
        </asp:SqlDataSource>
 
        </div>
    </form>
Tip 3: Enable Year Navigation in CalendarExtender
When the calendar appears, click on the title of the calendar to change the view to Months in the current year. Clicking it again, switches the view to Years, showing 10 years at a time.
If you plan to do this programmatically, here’s some code for you. Use the OnClientShown event and switch the mode using javascript. This tip was shared by one of the Microsoft® support person at the asp.net forums.
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
 <cc1:CalendarExtender ID="CalendarExtender1"
runat="server" TargetControlID="TextBox1" OnClientShown="ChangeCalendarView" />
Then add this to the <head> section
<head runat="server">
<title>CalendarExtender</title>
 
<script type="text/javascript">
function ChangeCalendarView(sender,args)
{
   sender._switchMode("years", true);           
}
</script>
</head>
Tip 4: Display only the day and month in the CalendarExtender
To select only the day and month without the year, use the Format property of the CalendarExtender and set it to “dd/MM” as shown below:
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM" TargetControlID="TextBox1" />
 
Tip 5: How to Set Culture to work with CalendarExtender
Make sure that the ScriptManager has EnableScriptGlobalization="true" and EnableScriptLocalization="true".
 
<asp:ScriptManager ID="ScriptManager1" runat="server"
         EnableScriptGlobalization="true" EnableScriptLocalization="true" />
Tip 6: How to make sure user does not select a date earlier than today or greater than today
There could be instances where you do not want the user to select a day earlier than the current date. For example: when you are providing the user a form to book tickets, you would not like him to choose an earlier date. To achieve this requirement, use the following javascript code.
Prevent the User from selecting a Date Earlier than today
<head runat="server">
    <title>Calendar Extender</title>
    <script type="text/javascript">
    function checkDate(sender,args)
{
 if (sender._selectedDate < new Date())
            {
                alert("You cannot select a day earlier than today!");
                sender._selectedDate = new Date(); 
                // set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
}
    </script>
</head>
Call the code:
   <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
          
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <cc1:CalendarExtender ID="CalendarExtender1"
            runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />
 
        </div>
    </form>
Select Date Greater than today
In the javascript, just change this line
sender._selectedDate > new Date()
Note: You may argue that the user can still change the date by typing into the textbox or entering an invalid date. Well that can be easily handled using a ValidationControl and is covered in the next tip.
Tip 7: Add validation to the CalendarExtender Control
A simple way to add validation to the Calendar is to add a ValidationControl to the textbox associated with a CalendarExtender. You have two choices:
A.    Add an ‘Extender’ to the ValidationControl. To do so, drag and drop a ValidationControl > click on the smart tag of the ValidationControl > choose ‘Add Extender’. From the Extender Wizard, choose ValidatorCalloutExtender. Using this approach makes it extremely easy to discover and attach control extenders to your controls. In VS 2005, you had to do this process manually, by wiring up control extenders.
B.    You can choose not to add the Extender.
We will go ahead with option A. We will be adding two ValidationControls to the textbox. The first, a CompareValidator to check if the user does not enter an invalid date (Eg: May 32) and second, a RangeValidator to keep the date range as desired.
Adding CompareValidator
<asp:CompareValidator ID="CompareValidator1" runat="server"
                ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="Invalid Date"
                Operator="DataTypeCheck" Type="Date">
</asp:CompareValidator>
<cc1:ValidatorCalloutExtender ID="CompareValidator1_ValidatorCalloutExtender"
                runat="server" Enabled="True" TargetControlID="CompareValidator1">
</cc1:ValidatorCalloutExtender>
Adding RangeValidator – We will restrict the user to select a date range starting from today to 15 days from now.
<asp:RangeValidator ID="RangeValidator1" runat="server"
                ControlToValidate="TextBox1" ErrorMessage="RangeValidator"
                Type="Date">
</asp:RangeValidator>
<cc1:ValidatorCalloutExtender ID="RangeValidator1_ValidatorCalloutExtender"
                runat="server" Enabled="True" TargetControlID="RangeValidator1">
</cc1:ValidatorCalloutExtender>
 
In the code behind of your page, add this code
C#
    protected void Page_Load(object sender, EventArgs e)
    {
        RangeValidator1.MinimumValue = System.DateTime.Now.ToShortDateString();
        RangeValidator1.MaximumValue = System.DateTime.Now.AddDays(15).ToShortDateString();
    }
VB.NET
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            RangeValidator1.MinimumValue = System.DateTime.Now.ToShortDateString()
            RangeValidator1.MaximumValue = System.DateTime.Now.AddDays(15).ToShortDateString()
      End Sub
Well those were some tips associated with the CalendarExtender. As future versions of the toolkit are released, we should be hopeful that there will exist easier ways, of achieving the functionality discussed in this article. I hope this article was useful and I thank you for viewing it.
If you liked the article,  Subscribe to my RSS Feed. 









Page copy protected against web site content infringement by Copyscape


How would you rate this article?

User Feedback
Comment posted by Tim on Tuesday, June 03, 2008 12:10 PM
Great article, and I found it just in time to use a calander control. Thanks a bunch.
Comment posted by Mitch on Thursday, June 19, 2008 11:34 AM
This is a great article.  I'm having a problem with the RangeValidator though. I"m using ajax tabpanels inside a FormView.  When I use the code-behind for C#, it erros that it can't find the RangeValidator1.

How do I find the RangeValidator1 is inside the FormView and Ajax Tab:
FormView1.TabContainer1.TabPanel2.DateTextBox
Comment posted by Suprotim Agarwal on Friday, June 20, 2008 11:08 PM
Tim, Mitch: Thanks for the comments.

Mitch: Did you try using FindControl()?
Comment posted by Ronald Avendaño on Monday, June 23, 2008 6:01 PM
Great job, i guess its easy to use.

ronald.avendano@gmail.com
Web Developer
Comment posted by Bob on Friday, June 27, 2008 11:28 AM
Seems that using the < sign will not work if the user selects the current day. Also tried this but it also alerts:

if ((sender._selectedDate >= new Date())==false)

selectedDate is returned as follows:

Fri Jun 27 2008 00:00:00 GMT -400 (Eastern Daylight Time)

new Date() is returned as follows:

Fri Jun 27 2008 11:16:45 GMT -400 (Eastern Daylight Time)

I'm guessing because of the time value selecting the current day fails the < comparison.  Since the >= comparison mimics the < comparison it also fails.

So what do we do? Parse the string and only match on the day?

-- Bob
Comment posted by Jack on Friday, June 27, 2008 11:37 AM
The above doesn't work when you use a popupbuttonid field.  It ends up not firing at all.
And Bob, if you want them to select from Today back, shouldn't you be using <= instead of >=?  
Comment posted by Bob on Friday, June 27, 2008 11:47 AM
Seems that using the < sign will not work if the user selects the current day. Also tried this but it also alerts:

if ((sender._selectedDate >= new Date())==false)

selectedDate is returned as follows:

Fri Jun 27 2008 00:00:00 GMT -400 (Eastern Daylight Time)

new Date() is returned as follows:

Fri Jun 27 2008 11:16:45 GMT -400 (Eastern Daylight Time)

I'm guessing because of the time value selecting the current day fails the < comparison.  Since the >= comparison mimics the < comparison it also fails.

So what do we do? Parse the string and only match on the day?

-- Bob
Comment posted by Bob on Friday, June 27, 2008 11:51 AM
Whoops.. sorry about the double post.

Actually I want them to select from today forward.  Guess we could just parse the string and compare on the month day year.

At this point I have it on my todo list.  It's not a deal-breaker as it just notifies the user that they can't select a day prior to the current day.  It still allows the current date however.

-- Bob
Comment posted by Carl-Willy Stenberg on Wednesday, July 02, 2008 4:34 AM
Hello!

Nice article about a extremly useful control.

We run into an issue where our customer wants the week nr to be visible. It seems that the
extender lacks this feature. Is that so?

Regards
Comment posted by Suprotim Agarwal on Thursday, July 03, 2008 1:16 PM
Bob: Let me know if you are still facing an issue and I could probably look into it.

Carl: Please could you restate your question (week nr?)
Comment posted by Dhiraj on Thursday, July 10, 2008 1:17 AM
Sir,
   I am the student of C-DAC Akurdi.I am doing project on dotnet. One module in this project contain sending SMS to client can you give me core idea about sending SMS in dotnet(using c#).
thank you
Comment posted by jim tollan on Thursday, July 17, 2008 7:07 AM
you also might want to add this to the properties:

EnabledOnClient="true"

i.e.

<ajaxToolkit:CalendarExtender ID="calShippedDate" EnabledOnClient="true" runat="server" TargetControlID="txtShippedDate" PopupButtonID="imgShippedDate" />

that way, the code is run locally on the client machine rather than making a round trip to the server and back.

btw - good to see you using TBH architecture for your site ;)
Comment posted by Suprotim Agarwal on Thursday, July 17, 2008 12:29 PM
Jim: Thanks for that snippet.

Yes I am using the TBH. Kept the beer glasses rating icon as-is to help identify that!!
Comment posted by sarita on Wednesday, July 30, 2008 7:30 AM
how we can show flat whole month of calendar in a page
Comment posted by Drake on Thursday, July 31, 2008 10:03 AM
What is flat whole month?
Comment posted by Chris on Monday, August 18, 2008 3:40 PM
How can you enabled/disable the calendar pop-up in javascript?  I have a page that has a checkbox that defines a set date range when checked.  If unchecked, it is suppose to enable the pop-up calendar as well as the textbox.  The textbox is not an issue but I can't find a way to suppress the calendar pop-up on the client side.  Any ideas?
Comment posted by Chris on Monday, August 18, 2008 4:05 PM
How can you enabled/disable the calendar pop-up in javascript?  I have a page that has a checkbox that defines a set date range when checked.  If unchecked, it is suppose to enable the pop-up calendar as well as the textbox.  The textbox is not an issue but I can't find a way to suppress the calendar pop-up on the client side.  Any ideas?
Comment posted by Abdul Majid on Thursday, September 11, 2008 9:09 AM
This is excellent stuff, keep it up!!
Comment posted by Glen on Monday, September 29, 2008 4:24 AM
Hi, I like the fluid UI of the calendar extender however i would like to use this as a standard calendar control and not just a popup.  Is it possible to persist the calendar into the page?
Comment posted by Suprotim Agarwal on Monday, September 29, 2008 10:49 PM
Glen, Chris: See if this helps
http://thenewblack.sirotamail.com/2007/09/use-ajaxnet-calendarextender-as-alwas.html
Comment posted by Sumanta on Saturday, October 04, 2008 5:04 AM
Plzz slove my problem
i want to setting a upper And lower date setting in calender extender on Ajax
Comment posted by mohani ranjan on Saturday, October 18, 2008 12:24 AM
this is example of ajax
Comment posted by Vivek Rathore on Saturday, October 25, 2008 6:34 AM
Although it is good enough for the date earlier than current date, but what if i select the current date. Then it seems that the validation fails for the scenario if someone select the current date in calendar and compare it with current date. Is'nt it??
Bob is absolutely right that time value selecting the current day fails the < comparison.
Comment posted by Hooman on Thursday, October 30, 2008 4:09 AM
Thank you, it was a great complete article
Comment posted by aslam on Wednesday, November 05, 2008 12:25 PM
great article. have bunch of info. but i am facing a problem. calendar is hiding behind the dropdownlist (combo box). how to avoid this. please solve my problem
Comment posted by Suprotim Agarwal on Thursday, November 06, 2008 11:52 AM
Aslam: Which browser are you using. Seems like an issue of z-index.
Comment posted by Anada on Thursday, December 11, 2008 7:20 AM
Nice article,but I needed some more information on setting the date of Calender Extender control. Can anyone please help me regarding this.
Thanks.
Comment posted by manoj choukse on Monday, December 15, 2008 7:47 AM
hi
fist fall i want to know,
how to disable sunday in CalendarExtender.
plz solve my problem with asp.net and c# code.
Comment posted by ShiningLife on Tuesday, December 16, 2008 12:05 AM
hi,
I am using calender extender in the gridview while insert & edit records.
It works fine in insert.
The problem is that when i want to update any record without changing the date field.
It is not allowing to update the record untill i have to select any date again while editing, otherwise it gives the error like 'conversion failed'.

In database the date field is in date format '2008-12-08 00:00:00.000'.

plz solve this problem as it should allow me to update the record whether i edit the date field or not.

Thanks to all.
Comment posted by Waka on Tuesday, December 30, 2008 11:48 AM
hi, how to add calendar value into textbox ? when i run it, everything works fine when i wanted to pass the textbox date value to next page. it give mi an Nullexception error. run it on web it show the date when stepin there is nothing in the textbox. why ?
Comment posted by Prashant Chandrakar on Friday, January 30, 2009 2:02 AM
Hi,
I am using CalendarExtender.
I just want to set a different color for sunday,
Or if possible then any column of the calender.

Something like On ASP.net server control Calender is having a attribute called WeekendDayStyle.
Comment posted by nidan on Thursday, March 05, 2009 5:22 AM
I am using CalendarExtender. Ajax Calendar Extender Not Moving with Scroll in FireFox .
Comment posted by wooper on Thursday, March 12, 2009 12:21 PM
Hi, i have the same problem as bob, if you type, if (sender._selectedDate < new Date()), the user cant be able to select the current day, what can we do to solve this problem?? any ideas??
Comment posted by Suprotim Agarwal on Sunday, March 15, 2009 1:56 AM
wooper: See if this post helps: http://forums.asp.net/t/1384286.aspx
Comment posted by Tony Peterson on Friday, March 27, 2009 9:18 AM
Does anyone know how to set the CalendarExtender so it always opens set to today's date? I tried doing so but for some reason, my function gets called yet the date doesn't get set. My code is:

        function settoday(sender, args) {
            sender._selectedDate = new Date();
            // set the date back to the current date
            sender._textbox.set_Value(sender._selectedDate.format(sender._format))
        }

    <cc1:CalendarExtender ID="prodDateExtender" runat="server" TargetControlID="CalInput" PopupButtonID="Image1"   OnClientShown="settoday"/>
Comment posted by Karun on Monday, March 30, 2009 5:04 AM
Hi. Nice Article regsrding the Ajax Calander Extender. But I want to validate the date on client side only. I had written a date validation function in Java Script and when I run the application I am getting error. So you have any date validation javascropts to be used in OnclientsideScript in calander Extender.
Thanks  in Advance.
Comment posted by sharma on Thursday, April 02, 2009 5:43 PM
Hi

It does not show all days of week. It only shows days from Sunday to Thursday.
Your help will be greatly appreciated.

Comment posted by Suprotim Agarwal on Sunday, April 05, 2009 7:16 AM
Karun: You can use the OnClientDateSelectionChanged property of the Calendar Extender and point it to a JavaScript.

Sharma: Your CSS is causing an issue. Check this thread: http://forums.asp.net/t/1147646.aspx
Comment posted by hamid on Monday, May 18, 2009 3:50 AM
i m using ajax calendar extender i can dispaly the date in the textbox.but i m not able to store the tat date in data base? any solution for tat
Comment posted by shafique on Tuesday, May 19, 2009 4:31 PM
this is a helpful article, thanks! but i am trying to ensure that one date does not exceed another date. I have two textboxes with two ajax calendar extenders. i want to make sure that Date1 < Date2, and i don't want to post back to the server to check this.

any help? i want to use the <asp:comparevalidator> like:

<asp:CompareValidator ID="DateCompareValidator" ControlToValidate="FromDate" ControlToCompare="ToDate" Type="Date" Operator="LessThanEqual" Text="From Date must be less than the To Date." runat="server"></asp:CompareValidator>

But this doesn't work.. any ideas?
Comment posted by Ken 2g on Tuesday, June 09, 2009 6:58 AM
Hi, I want to restrict the user to picking the date from the calendar control. The user should not be able to enter the date manually without picking from the calendar. Can anyone help me?
Comment posted by Suprotim Agarwal on Wednesday, June 10, 2009 4:00 AM
Ken 2g: Check this post: http://forums.asp.net/t/1397407.aspx
Comment posted by Dipesh on Thursday, June 18, 2009 1:42 PM
Excellent article. I'm literally able to pick it up good. Please do me one thing. Add more examples with use in ASP.NET 3.5 Dynamic Data or MVC.
Comment posted by Basheer on Saturday, June 27, 2009 12:10 PM
Hi,
Thanks for the article. But, I need to know some more tricks with calendar extender..When I use this extender with a target textbox  within a template field of any other control(say DetailsView or GridView) and if that parent control is in absolute position format, calendar does not pop up at the desired positions. It pops up far away from the target textbox. Any trick to fix this issue
Comment posted by dheena on Monday, June 29, 2009 2:46 AM
it is working fine .
Thanks
Comment posted by chandrika on Monday, June 29, 2009 7:43 AM
have got solution for your problem,as i am facing the same problem
Comment posted by Suprotim Agarwal on Thursday, July 02, 2009 2:19 AM
Dipesh: I will soon come up with MVC articles!

Basheer: I will have to try that out and see. Let me know if you have not found any solution and I will take out some time@weekend to help you out.

Chandrika: What problem?
Comment posted by kuno2011 on Monday, July 13, 2009 10:11 AM
i got the same problem as basheer! i have a DIV on left side for treeview and DIV on right side for data display. each div has their own scrollbar. when i scroll the right side vertically and click on a calendar button (right side), the calendar will show very far away from where i click... sometimes it is so far that i can't even see it... however, if i don't scroll vertically before clicking, it is working fine...... thanks
Comment posted by smd on Tuesday, August 25, 2009 5:55 AM
m at the first step on the learning curve so please bear if my question sounds silly...
i got a text box with an extended calender control...i need to capture the date to a variable when the user selects a date but m getting an error.
---------------
Dim birthday_value As Date
birthday_value = TextBox1_CalendarExtender.SelectedDate.Value
-------------------
the error m getting is - System.InvalidOperationException: Nullable object must have a value

any help is much appreciated
Comment posted by David H on Thursday, September 10, 2009 9:07 PM
The position of the AJAX Calendar Exetender can be manipulated by setting a value for the margin-top;margin-left;margin-right;margin-bottom in the .ajax__calendar_container style.

Comment posted by Moazzam on Monday, October 05, 2009 1:04 AM
NEED URGENT REPLY GUYS...

"sender._textbox " is returning "null or not an object" error in JavaScript when using calendar in gridview to stop selecting earlier date. i have use the same example written in article with "img" popupID.

Also, calendar is not moving when i scroll the page.

I have searched a lot regarding this issue but unsuccessfull so Please Help!!!!
Comment posted by Tee on Wednesday, October 07, 2009 10:16 PM
Sorry, may i know that is the calander extended only run on .NetFramework 3.5? The above can't work on my project when i clicked on the image button it like post back the page, and show at the tool tips: Done, but with error on page.
Comment posted by Fenil Desai on Wednesday, December 30, 2009 12:55 AM
I have a problem..I m using the latest version of toolkit still the calendar doesn't hide after clicking outside the page. I m using a simple html image. any help...
Comment posted by Shital on Tuesday, January 05, 2010 8:49 AM
i am using ajax tool kit 1.0.20229 (can not use ajax toolkit 3.0)and framework3.0.
how to hide ajax calendar clicking anywhere on browser.
please help me out.
Comment posted by Anahcra on Sunday, January 24, 2010 8:31 AM
I got the following problem when i run solution for calendar extender. Hence what shall i do?


Server Error in '/CollegeMIS' Application.
--------------------------------------------------------------------------------

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +2108047
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) +762
   AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) +64
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Comment posted by Anuj Chauhan on Thursday, February 04, 2010 3:52 AM
Hi All,

When the calendar popups, How to set not to display the few extra dates which are not in the current month. Example: if Feb is selected then few ending dates of january (like ..., 29, 30, 31) and few starting date of march (like 1, 2, 3...) gets also visible in the Feb calendar, then how to set the calendar to display dates only belongs to selected month.

Regards,
Anuj Chauhan
Comment posted by Amit on Tuesday, February 16, 2010 1:06 AM
Hi,
Thanks for the article. But, I need to know some more tricks with calendar extender..When I use this extender with a target textbox  and there is grid below to the textbox. and I lock some rows of gridview in that case. I face the problem while poping up Calender control only half side of control shown properly...Plzzzzzzzz help me... Thankyou in Advance
Comment posted by sivasu on Tuesday, March 23, 2010 8:44 AM
hi ,

  how can i set the 'today button' instead of 'Today:March,23,2010'(in bottom of calender extender
Comment posted by rohit on Wednesday, April 21, 2010 4:00 AM
Hi,
  In Calender extender contorl, if we take the cairo +2:00 time zone and  if i select 30 april 2010, it take it as 29 april 2010. For 29 april 2011, it automatically set it as 28 april 2011. there is some issue regarding time zone with calender extender, If any one knows about this, please help.

Regards,
Rohit Kandpal
Comment posted by Anto on Saturday, July 10, 2010 8:36 AM
saved my time.....thanks much!!!
Comment posted by satish kumar on Thursday, August 19, 2010 12:46 AM
could you please explain how to show the details when current date is clicked.plz send the code to my email id
Comment posted by Wasim on Thursday, August 26, 2010 4:53 AM
Dear Sir/Madam,

Thank you for this control,
But when I went first time in Page that time Calendar Pop up but after page load same page calendar does not pop up.

Please help me if you get any solution for me at my Email - "wasimikukwa@gmail.com or wasimikukwa@yahoo.co.in"

i am waiting for you reply

Thakns

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel

NEWSLETTER