Wednesday, March 21, 2012

calendarextender questions

How do i let the users only pick the months instead of days? which mean i will be showing the months instead of the days which will be exclude from the calendar.

I would like to close the calendar when i click anywhere on the page. at this moment i only can close the calendar at the popupbutton or by selecting a date.
Any idea of how to achieve this effect like the good old calendar?

Anybody has some good theme for the ajax calendar? I want to achieve the same effect as the default one but only changing the color.
if I use a CSS file, the whole calendar theme is overwritten.

Sorry I am not an expert in javascript that's why all these questions.

Hi Donkaiser,

My understanding of your issue is that your have thress questions in your thread list below:

donkaiser:

How do i let the users only pick the months instead of days?

I'm afraid that there's no function can support your idea unless you modify the source code.

donkaiser:

I would like to close the calendar when i click anywhere on the page. at this moment i only can close the calendar at the popupbutton or by selecting a date.
Any idea of how to achieve this effect like the good old calendar?

Yes , please add this javascript function to your page:

function document.onclick(){
$find("<%=CalendarExtender1.ClientID %>").hide();
}

donkaiser:

Anybody has some good theme for the ajax calendar? I want to achieve the same effect as the default one but only changing the color.
if I use a CSS file, the whole calendar theme is overwritten.

I haven't found a satisfied one yet by now but you can change it based on its own css style.

I hope this helps.

Best regards,

Jonathan


"Yes , please add this javascript function to your page:

function document.onclick(){
$find("<%=CalendarExtender1.ClientID %>").hide();
}"

Where should i put this function in my page? like the header? does it have to include the tag

<script type= "text/javascript" language="javascript"> </script>?


Hi Donkaiser,

This is another sample address which for other customer's related question.There are similar.In your case ,you just need to replace the Javascript functions with

function document.onclick(){
$find("<%=CalendarExtender1.ClientID %>").hide();
}"

This sample shows how to show the calendar when the TextBox'sonfocus and onclick envent is fired and hide the calendar after a date is selected.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="yyyy-MM-dd" PopupButtonID="Button1"> </ajaxToolkit:CalendarExtender><asp:Button ID="Button1" runat="server" Text="Button" /> <script type="text/javascript" language="javascript"> function pageLoad(){ $addHandler($get("<%=TextBox1.ClientID%>"),"focus",showCalendar); } function showCalendar(){ $find("<%=CalendarExtender1.ClientID%>").show(); } function document.onclick(){ if(event.srcElement.id!="<%=TextBox1.ClientID%>") $find("<%=CalendarExtender1.ClientID%>").hide(); } </script> </form></body></html>
I hope this helps.
Best regards,
Jonathan
 
 

No comments:

Post a Comment