Wednesday, March 21, 2012

CalendarExtender with ImageButton problem........

In this application,when you press the ImageButton ,the calenda will show; when you press the ImageButton again or select a date ,the calenda will disappear..

But what I wanna realize is that ,when you click the rest of the page ,the calenda will also disappear, how to realize that??

Thank you very much!!!!!!!!!

Default.aspx

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="http://links.10026.com/?link=StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<br /><br />
<b>Calendar with associated button:</b><br />
<asp:TextBox ID="Date3" runat="server"></asp:TextBox>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Calendar_scheduleHS.png" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="Date3" PopupButtonID="Image1">
</ajaxToolkit:CalendarExtender>

</form>
</body>
</html>

Hi liuyan,

This is an issue of the Ajax Control Toolkit that is known for a while now.

It is even something that will be fixed in an upcoming release of the Toolkit.

You should check the website. This is a direct link to the Issue you talk about.http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7571

Look at the comments on that site: They include a workaround for this issue until it is fixed in the upcoming release.

Hope this helps!
Kind regards,
Wim


Hi liuyan,

For you situation, I think the easiest way is when hide the Calendar manually when OnClientDateSelectionChanged event occurs. Here is the sample you can refer to:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"
Format="yyyy-MM-dd" PopupButtonID="Button1"OnClientDateSelectionChanged="function hideCalendar(calendar) { calendar.hide(); }">
</ajaxToolkit:CalendarExtender>
<asp:Button ID="Button1" runat="server" Text="Calendar" />

I hope this help

Best regards,

Jonathan

No comments:

Post a Comment