.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

CalendarExtender date checker

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

I have read many forums to see if I could find a solution and there hasn't been anything that is what I need.  I have an asp:calendar that you select a date on there and a panel pops up.  On the panel, the start date and end date are filled with the selected date from the asp:calendar.  The end date field has the CalendarExtender.  When you open it, the selected date on there is the same as from the asp:calendar which is good.  What I need is to tweak my javascript to check to make sure that the user picks a date after the selected date from the asp:calendar.  so if they pick 11/4/2010 as a start date, the end date cannot be fore 11/4/2010.  Only anything after that.  Not todays date(ex. 10/22/2010).

codebehind for my asp:calendar sending the dates

        'post date in panel
        If e.Day.IsSelected Then
            txtSDate.Text = e.Day.Date
            txtEndDate.Text = e.Day.Date
        End If
JavaScript and asp code
        <script type="text/javascript">
            function checkDate(sender, args) {
                if (sender._selectedDate < new Date()) {
                    alert("You cannot select a day earlier than today!&q

View Complete Post

More Related Resource Links

CalendarExtender wrong date from database



I'm about to go NUTS :)

I have 2 CalendarExtenders on page. And I want to show the date that I get from SQL SEVER:

select -> SELECT convert(datetime,  begin) as Begin, convert(datetime, end) as End FROM Table

The date field, on base,  is a char(8)  and the record is like YYYYMMDD. That's why I convert it to datetime.

But, on code behind when I do this :

CalendarExtender1.SelectedDate = DateTime.Parse(objDataEvento.Rows(0)(2))
CalendarExtender2.SelectedDate = DateTime.Parse(objDataEvento.Rows(0)(3)) 

Depend of the date, It's showing minus 1 day on page.

Like: If, on base, the date is 08/12/2010, on page it's showing 07/12/2010.

WHYYYYYYYYYYYY ??????????????? Cry Smile




AjaxControlToolkit.CalendarExtender - highlight current date

I have used AjaxControlToolkit.CalendarExtender for calendar in my project.but anyhow I am unable to highlight current date  in calendar control.(Note: Current date I mean is today's date and not the selected date.)e.g.( If today is 15th August 2010, and I have selected 24 August 2010. then when I press calendar icon, I should see 15 august highlighted with different look or same as selected date 24 highlighted in August month of 2010 page in calendar popup.)Please guide me to accomplish the taskThanks in advance for support.

Formatting the date with the CalendarExtender

I must be missing something here.  I use the code below to display a DateTime value, and the time is always displaying, i.e. 7/11/2010 08:10:10. I just want the date.  The Format value doesn't seem to have any effect.    <asp:TemplateField HeaderText="Exp Date" HeaderStyle-Width="100px">   <ItemTemplate>   <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("expirationDate") %>'></asp:TextBox>   <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="MM/dd/yy" />   </ItemTemplate>   </asp:TemplateField>

ajaxtoolkit:CalendarExtender disable the dates which are lessthan current date


 hi frds

i'm using ajaxtoolkit:calenderextender

in this i should not be able to select dates which are lessthan currentdate

is this possible?

how to solve this ?

thank u in advance



Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

Code spelling checker extension for visual studio 2010

Building a spelling checker for source code as an extension for visual studio 2010.

Built-in Functions - Date and Time Functions

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

Essential SQL Server Date, Time and DateTime Functions

The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.

Date/Time Conversions Using SQL Server

There are many instances when dates and times don't show up at your doorstep in the format you'd like it to be, nor does the output of a query fit the needs of the people viewing it. One option is to format the data in the application itself. Another option is to use the built-in functions SQL Server provides to format the date string for you.

Date and Time Data Types and Functions

The following sections in this topic provide an overview of all Transact-SQL date and time data types and functions. For information and examples that are common to date and time data types and functions

SQL Server Date Formats

One of the most frequently asked questions in SQL Server forums is how to format a datetime value or column into a specific date format. Here's a summary of the different date formats that come standard in SQL Server as part of the CONVERT function. Following the standard date formats are some extended date formats that are often asked by SQL Server developers.

ListViewControl - how to group items by their value, for eg. date range



I have a table containing courses, columns are 

Name - "Yoga Classes"

DateStart - "2/23/2010"

DateEnd - "2/24/2010"

I am using ListView Control to bind it, is there a way to display them and group them by Month? 

for eg.


Piano Class (10th Jan 2010 - 11th Jan 2010)
Guitar Class (10th Jan 2010 - 11th Jan 2010)


Yoga Class (15th Feb 2010 - 16th Feb 2010)

Thanks for help.

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