Reputation: 3310
I am trying to add a DnnDatePicker to my custom DotNetNuke module but I get a "Error Creating Control" error (unknown server tag dnn:DnnDatePicker) and the control is underlined as "Element DnnDatePicker is not a known element. This can occur if there is a compilation error in the website or the web.config file is missing".
My import statements:
<%@ Register Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" TagPrefix="dnn" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/labelcontrol.ascx" %>
<div style="font-weight:bold" aria-haspopup="True" class="DatePickerText"></div>
<dnn:DnnDatePicker runat="server" ID="StartDatePicker" /></div>
I'm using asp.net 4.5 and DNN 7.2.2
Any ideas?
Upvotes: 1
Views: 1506
Reputation: 500
*** Add Reference >> DotNetNuke (\bin\DotNetNuke.dll)
At the page top:
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
Then to show the DatePicker:
<dnn:DnnDatePicker ID="dnnDatePicker1" runat="server" CssClass="cssClass1" />
Upvotes: 3
Reputation: 204
I'm not sure exactly what causes this issue, however, I think it has to do with the fact that you're referencing a web.config file that does not exist in the module project folder. I found the easiest way to work with Christoc's module template is to create your project per the instructions in Visual Studio, change the configuration appropriately, add a basic control, build and install in DNN.
THEN, open your complete DNN website in Visual Studio and navigate to the module code (should be in DesktopModules). From the main site, the controls open in designer and you can take full advantage of all designer tools, etc.
Upvotes: 0