Ok, like I said, I'm new to writing server side controls. I figured out I can add an existing server side control to make a "compound" control instead of writting all the HTML directly. So I just added an ASP.NET text box and then called the normal InvokePopupCal methods to build my javascript call.
I had problems getting the PopupCalendar.js include registered, I had to put the RegisterClientScriptInclude call in the PreRender event. So here are the relevant code bits that I have so far. Still need to fully test this but I think I got the core bits working.
Private popupCal As Image
Private dateBox As TextBox
...
Protected Overrides Sub RenderEditMode(ByVal writer As System.Web.UI.HtmlTextWriter)
'Add the date data entry box
dateBox = New TextBox
dateBox.ID = Me.Name
dateBox.EnableViewState = True
dateBox.Text = StringValue
Me.Controls.Add(dateBox)
dateBox.RenderControl(writer)
'Add the calendar control
Dim attrib As String
popupCal = New Image
popupCal.ID = "imgCal"
popupCal.ImageUrl = "~/images/SmallCalendar.gif"
Me.Controls.Add(popupCal)
attrib = CType(DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(dateBox), String)
popupCal.Attributes.Add("onClick", attrib)
popupCal.RenderControl(writer)
End Sub
If Not Page.ClientScript.IsClientScriptBlockRegistered("PopupCalendar") Then
Me.Page.ClientScript.RegisterClientScriptInclude("PopupCalendar", ClientAPI.ScriptPath & "PopupCalendar.js")
End If
End Sub
Private Sub DateEditControl_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender