Wednesday, March 21, 2012

Default Calendar view set at decades

Hi,

I'm using the Calendar control for a Date Of Birth field on my form. However I would prefer the calendar to open up on the decades screen so that members will be able to tell easily what they have to do. I have a feeling that if the calendar pops up displaying October 2007 for example, the users won't realise they can click on the title to go up a level. Whereas if they start on 2000-2009 its more easier to understand.

Thanks,

Curt.

Sorry to bump this thread, but does anyone know how to do this?


Hi CurtWRC,

My understanding of your issue is that you want to make the CalendarExtender to shown as "Year Mode" instead of "Day Mode". If I have misunderstood, please feel free to let me know.

Here is the sample which I switch the display mode on its OnClientShown event.

<%@. 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 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"OnClientShown="onCalendarShown"> </ajaxToolkit:CalendarExtender> <script type="text/javascript" language="javascript"> function onCalendarShown(sender,args){ sender._switchMode("years", true); } </script> </form></body></html>
Best regards,
Jonathan

Thatsexactly what I was after. Thanks Jonathan!

No comments:

Post a Comment