CalendarExtender On TextChange

Posted on 2009-07-08
Last Modified: 2012-05-07
I would like to use the AJAX CalendarExtender. Is it possible to attach a C# event which will fire when the date is chaneg.
Question by:Mr_Shaw
LVL 20

Accepted Solution

ddayx10 earned 500 total points
Comment Utility
This isn't exactly what you asked for, but it's as close as I can get'cha :)

Can use client functional of CalendarExtender to send info to postback, and do something from there. See Snippet...
***ASPX PAGE****

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head runat="server">

    <title>Cal Extender Event</title>

    <script type="text/javascript">


		function selectionChanged(sender,args)


			//just about all calendar properties, etc are avail by using


			//If you wanted to send back a more complex argument then I have used

			//Sys.Serialization.JavaScriptSerializer to package them up

			//then de-serialize on the server side :)







    <form id="form1" runat="server">

		<asp:ScriptManager ID="sm" runat="server" />


		<asp:TextBox ID="txtCal" runat="server" />

		<asp:Button ID="btnCal" runat="server" Text="Show Calendar" />






			OnClientDateSelectionChanged="selectionChanged" />





public partial class Default7 : System.Web.UI.Page


    protected void Page_Load(object sender, EventArgs e)


        if (IsPostBack)


            string eTarget = Request.Params.Get("__EVENTTARGET");

            string eArg = Request.Params.Get("__EVENTARGUMENT");

            if (!string.IsNullOrEmpty(eTarget) && !string.IsNullOrEmpty(eArg))


                doStuff(eTarget, eArg);




    private void doStuff(string cTarget, string cArg)


        //do something



Open in new window


Author Closing Comment

Comment Utility

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now