Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Profile Edit ControlProfile Edit Control
Previous
 
Next
New Post
2/9/2007 9:01 AM
 
I'm trying to create a "Date" profile edit control and would like to use the DNN pop-up calendar.  I'm new to writing server side controls so I started with the code for the Integer control.  I switched the integer data types to DateTime and got the display and entry of the data to be a dates but I'm having problems figuring out the best way to get the DNN pop-up calendar javascript registered.  The normal call to do this (InvokePopupCal) requires a System.Web.UI.WebControls.TextBox to be passed in but the EditControl class is not inherited from a TextBox but writes the <input> tag itself so I don't have a TextBox control to send to the function.

Should I just copy the InvokePopupCal and modify it to work with my <input> control?  I don't like this because for every DNN release I'll have to make sure the javascript or the InvokePopupCal method hasn't changed.

Anybody else have any better ideas? 

 
New Post
2/12/2007 11:31 AM
 

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
 
New Post
2/12/2007 1:41 PM
 

Sounds like you are working in the right direction.

I have created a few articles on my site that describe how the various EditControls work, and how to create new ones.

When I created the initial set of core controls I decided that for the most part they would be created as "Rendered" controls rather than "Composite" controls, although you will note that the DNNRichTextEditControl is designed as a Composite control (by neccessity). 

There are two controls that seem to be requested as additional controls - Date and Image(File).

Good luck, and keep us updated.

 


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Profile Edit ControlProfile Edit Control


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out