Top Ad unit 728 × 90

recent

How To Use Calendar Control in Asp.Net

Today in this tutorial we will learn how to use Calendar Control in Asp.Net. You can use a calendar to select a particular date. Basically there are two ways to use calendar control in Asp.Net :
  1. Calendar Control using Standard Tools.
  2. Using Caledar Extendar from Ajax Control Toolkit 
Here I am showing you both the ways. So lets start the tutorial.

calendar-in-asp.net
 

Calendar using Standard Calendar Control ::

 Step 1 ::


First you need to fetch four control from the toolbox three from Standard Toolbox and one from Ajax Control Toolkit.

Goto Toolbox > Standard Tools > Calendar     // Calendar1
Goto Toolbox > Standard Tools > TextBox     // TextBox1
Goto Toolbox > Standard Tools > TextBox     // TextBox2

Goto Toolbox > Ajax Control Toolkit > ToolScriptManager

if you don't have Ajax Controls then you can install it by following the link given below.

You might also like this :: How To Add Ajax Control Toolkit To Visual Studio


How-to-use-calendar-control-in-asp-.net



 Step 2 ::


After following the above' steps generat the Calendar' SelectionChanged event (Calendar1_SelectionChanged) and write a one line code.

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            TextBox1.Text = "Selected Date Is :" + Calendar1.SelectedDate;
        }

How-to-use-calendar-extendar

this will show the selected date into the TextBox1.

You might also like this :: How to use Balloon Popup Extendar in Asp.Net

 Step 3 ::


Now save all the things and view page in Browser.

Calendar-Control-using-ajax

Now you can see that when you click on any date it will shown into the TextBox1. So you have done with simple calendar control using Standard Tools.



Calendar using Calendar Extendar from Ajax Controls ::
This the second way to use the Caledar in Asp.Net. In this, you will learn how to display a popup calendar whetn someone move focus to a textbox.
For this you need three things that we already fetched from the toolbox i.e.

  1. TextBox
  2. ToolScriptManager
  3. CalendarExtendar


 Step 1 ::


Now goto the Smart Menu of Textbox2 and click on the add extendar
Calendar-using-caledar-extendar


You might also like this :: How to Use Popup Control in Asp.Net

 Step 2 ::


When you click on the add extendar a window will open, now what you have to do, select Calendar Extendar from that window and clikc on OK button.

tips-to-use-calendar-extendar



 Step 3 ::


Now see the page in Browser, you will see that when you move focus to the TextBox2 a calendar will popped up.

Calendar-with-ajax-control-toolkit



From the Editor’s Desk
Finally you have done with both the ways to use the Calendar Control in asp.net. hope this will help you to increase you programming skills.

Thank you for giving your time.

How To Use Calendar Control in Asp.Net Reviewed by Team tt24 on 9:54 PM Rating: 5

No comments:

All Rights Reserved by Ask To Chimp © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.