The Mighty Blog

How To Implement the Client-Side DotNetNuke Calendar

Mar 18

Written by:
3/18/2007  RssIcon

There is a handy-dandy little calendar control that DotNetNuke (DNN) uses to insert a date value into a textbox control. However, it is not obvious in its usage. If you look at the source of any of the core modules or admin modules that use the control, you will see the following code in the HTML.

<asp:hyperlink
id="cmdCalendar" resourcekey="Calendar" cssclass="CommandButton"
runat="server">Calendar</asp:hyperlink>

If you look in the code-behind for this, you will notice that there are no events assigned to this control. In order for this control to be used like the core modules do, you need to "invoke" the calendar in the Page_Load event. This "InvokePopupCal" method must be fired every time the module reloads. So, do not put it within a Postback If statement.<

'this needs to always execute so the client script code is registered using InvokePopupCal
cmdCalendar.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtPickUpDate)

The code above actually handles all of the client-side code that will be needed for the calendar to insert the date like you expect it to. Be sure to pay attention to the control that you pass into the "Field" argument (txtPickUpDate above). This is the control that the script will attempt to insert the date into. Although I have not tested this out, I believe that the only control this should work with is a textbox control.

Tags:
Categories: DotNetNuke

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
Add to Technorati Favorites
Tweet about my blog
The opinions expressed here are the personal opinions of Will Strohl and do not necessarily represent the views and opinions of the DotNetNuke Corporation.
© Copyright 2004-2011 by Will Strohl. All rights reserved. Website Skinned By: Ralph Williams  Website Hosted By: Applied Innovations