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.
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
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.
Labels: controls, DotNetNuke, how to, tip
1 Comments:
At 1:06 AM ,
Anonymous said...
Just wanted to thank you for your tip on using the DNN Calendar.
I was able to cut and paste and voila get it working.
Peace, Paul
Post a Comment
Subscribe to Post Comments [Atom]
<< Home