Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Ajax CalendarExtender Example In Asp.Net -Change date format and show calendar when click on button

Jun 4, 2012
Introduction:

In this article I will explain how to use Ajax Calendar extender control in asp.net and how to change date format in ajax calendar control and display calendar control when click on image button in asp.net.

Description:

Previously I explained many articles relating to 
Ajax. Now I will explain how to use ajax calendar extender control in asp.net and change date format and display calendar control when click on image button in asp.net. Before proceed to implement this have you install ajaxcontroltoolkit in visual studio or not if not install it otherwise if you already done then follow the below steps to use Ajax calendar extender control example in asp.net.


First create one new website and add AjaxControlToolkit reference to your application after that write following line in your aspx page

<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax" %>

Once we add above references design your aspx page will be likes this

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ajax Calendar extendar control exmaple in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<ajax:ToolkitScriptManager ID="toolkit1" runat="server"></ajax:ToolkitScriptManager>
<table>
<tr>
<td><b>Select Date:</b></td>
<td>
<asp:TextBox ID="txtDate" runat="server" />
<ajax:CalendarExtender ID="CalendarExtender1" TargetControlID="txtDate" Format="dd/MM/yyyy" runat="server">
</ajax:CalendarExtender> 
</td>
</tr>
<tr>
<td><b>Select Date</b></td>
<td>
<asp:TextBox ID="txtDate1" runat="server"/> <asp:ImageButton ID="imgbtnCalendar" runat="server" ImageUrl="~/Calendar.png" />
<ajax:CalendarExtender ID="CalendarExtender2" TargetControlID="txtDate1" PopupButtonID="imgbtnCalendar" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>
If you observe above code I define some of properties to ajax:CalendarExtender now I will explain all the properties of Ajax rating control

TargetControlID – The ID of control which is used to show calendar control when click on textbox or calendar image icon.

PopupButtonID – This property is used to set ID of control which is used to show calendar control when click on it.

PopupPosition – This property is used to indicate position of the calendar control when clicked on textbox.

SelectedDate – This property is used to set date of calendar control which is initially showed.

Demo


If you want to change style of Ajax calendar extender check this post Change Style of Ajax Calendar Control Extender in asp.net

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

34 comments :

Anonymous said...

Send code to create captcha at login..

chetan patil said...

Hi dear...
i am trying to use pasword strength control ajax tools in Default.aspx but it gives error i am using master page for layout. what i do for that... how to use ajax cantrol with master page?
plz help me
my mail id:-
csp567@gmail.com

Raj said...

yar suresh tu meko engineer bna ki hi chhodega.. nice writtern bro.. ur demos is fab

Raj said...

yar suresh tu meko engineer bna ki hi chhodega.. nice writtern bro.. ur demos is fab

ashsih said...

thanks you so much..

Programmeriscoder said...

Thanks Suresh

Kuldeep Singh said...

how to show MM/YYyY for mate.

Anonymous said...

hello sir i am getting this error please help me

Error 2 The type 'System.Web.UI.ExtenderControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. C:\Documents and Settings\admin\My Documents\Visual Studio 2005\WebSites\WebSite8\Default.aspx 15

kands said...

Respected suresh,
i have done the process completely which u have mentioned above. Inspite of getting no errors and even getting text box and button displayed ,the calendar is not popping up on button click.

actually i am using visual studio 2005 and it obviously has framework 2.0

downloaded and installed ajax extension also.
please see the source code once

body
form id="form1" runat="server"
div
asp:ScriptManager ID="ScriptManager1" runat="server"
/asp:ScriptManager


asp:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox1" runat="server" Enabled="true"
/asp:CalendarExtender

asp:TextBox ID="TextBox1" runat="server"/asp:TextBox


/div
/form

/body

and resolve my error

L.Rajesh said...

For DD/MM/YYYY Format :

Anonymous said...

hi sir i m kanchan frm mumbai it student doing website project i hav linking problems in my project help me

Veena said...

Hi Suresh,

is there any possibilities to switch the language of CalendarExtender control, like month & days are in English which I want to convert to Turkish or Spanish on base of choice taken by user...?

Thanks & Regards,

Om Mohokar said...

sir can you plz tell me ,,how to insert selected date from calenderextender when calender control selected date is clicked into textbox and then to the sql server2005

thank you sir...

raj said...

can anyone tell me how to add random vedio chat function in my website by using ASP.NET C#.
If anyone has such type of project plz send it to me mail :- ominglechat@gmail.com .

Plz plz plz guys its urgent....

Dendup Wangdi said...

Sir suresh i am getting this error:-

Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

could u tell me the solution???please

Anonymous said...

NICE TUOTORIAL CAN U UPDAE ITS CODE BEHIND IN c# FOR INSERT IN DATABASE

Anonymous said...

Hello Sir,

Nice Article. Why Ajax Not working in visual studio 2012. i added the respective dll also. then too its not working. can you please help me out for fixing this problem?

Jas Kumar said...

YOUR POST ALWAYS HELPING ME....THANK SURESH BRO....

Krishh said...

Hi suresh sir,

Nice post, Sir can you plz tell me ,how to Hijri calander ajax CalendarExtender control?

it's very urgent sir plz help me....

ASAP...

yugraj said...

hi suresh i am new to your posts and found it very useful .......can u please tell me how to use multiple control of ajax control toolkit having master page

krishanpal shingh Chundawat said...

Hello ,
I am getting a error on my Web form like this:

"The control Can not be displayed because its tag prefix is not registered on this web form "

But i add ajax toolkit . why this errore is showing any one help me please.

Anonymous said...

thanks man... u r a life saver....

Anonymous said...

Sir, I need asp.net calendar code for the following condition. How to colour today's dates and only 15 days greater than today. Dont colour 15 days/dates beyond today. Previous dates from today shouldnot be coloured too.

HEMANT said...

thank you so much dear sir

Abdul Khaliq said...

Excellent job sir....... :)

Anonymous said...

It will work so nice thank u friend

Muthu Vairavan said...

Send code to create captcha at login.
sent to mv6868@gmail.com

hardik said...

Hello Suresh, I am developing application to show ajax calendar. it works fine in local system but gives error while uploading to webserver with dll not found, i also uploaded specific dll but still nt possible. help me out.

santanu bankura said...

good................

nakul raju said...

hi suresh, tried above ajax code but facing tag register error.

parse error message: could not load file or assembly "AjaxcontrolToolkit" or one of its dependencies.

Ranjan Kumar Yadav said...

When We Select Year From DropDownList Then How to Display Date Of Selected Year In Calender Extender.
Plz Help me Sir

prince bawa said...

i can't save the date from calender extender into database
can anyone help me please ???

Ankit Pal said...

Respected suresh,
i have done the process completely which u have mentioned above. Inspite of getting no errors and even getting text box and button displayed ,the calendar is not popping up on button click.

actually i am using visual studio 2005 and it obviously has framework 2.0

downloaded and installed ajax extension also.
please see the source code once

body
form id="form1" runat="server"
div
asp:ScriptManager ID="ScriptManager1" runat="server"
/asp:ScriptManager


asp:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox1" runat="server" Enabled="true"
/asp:CalendarExtender

asp:TextBox ID="TextBox1" runat="server"/asp:TextBox


/div
/form

/body

and resolve my error

Maheshwara Vaijapur said...

Hi Suresh,

Thank you very much for this article, I'm beginner in .net, this helped me a lot..

Thanks

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.