Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CalendarExtender On TextChange

Posted on 2009-07-08
2
Medium Priority
?
812 Views
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.
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
ddayx10 earned 2000 total points
ID: 24810375
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<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
			//sender._[propertyName]
			//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 :)
			__doPostBack(sender._id,sender._selectedDate);
			
		}
    </script>
</head>
<body>
    <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" />
 
		<cc1:CalendarExtender 
			ID="CalendarExtender1" 
			runat="server"
			TargetControlID="txtCal" 
			PopupButtonID="btnCal"
			OnClientDateSelectionChanged="selectionChanged" />
 
    </form>
</body>
</html>
 
 
****CODE BEHIND****
 
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

0
 

Author Closing Comment

by:Mr_Shaw
ID: 31601215
THANKS
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello World !, Thanks : My Sincere thanks to @Michael Male who encouraged me to write an article on this in my  blog (http://scribblejava.wordpress.com). Introduction:       There are several technical issues a developer may face in his…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

660 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