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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Adding a .Net user control into DotNetNuke as a ModuleAdding a .Net user control into DotNetNuke as a Module
Previous
 
Next
New Post
4/14/2008 4:25 PM
 

Hi,

We have a DotNetNuke 04.08.01installation. We would like to use "User Controls", created in C#, as modules in this installation.

I have not been able to figure out how to Import the User Controls into DNN as Modules.

Can someone point me to detailed instruction on how I can import the "User Controls" into DNN as Modules

Thanks

IJ

 

 

 
New Post
4/14/2008 4:47 PM
 

You can check out Michael Washington's tutorials at http://www.adefwebserver.com/DotNetNukeHELP/ to give you a general idea of how DNN modules work, and some specific scenarios to be aware of.

However, there isn't a basic "how to add an existing user control as a module" tutorial available.  Let me try to explain what I would do in your case.

  1. Add the user control to a folder under the DesktopModules folder of your website (e.g. ./DesktopModules/ExistingControl/ExistingControl.ascx).
  2. Go to the Module Definitions page under the Host menu
  3. In the upper left corner, choose Create Module Definition under the actions drop down
  4.  Fill in the information on the form, giving your module whatever name and description you'd like
  5.  Once you've clicked update, you can create a module definition at the bottom of the page (again, whatever name you'd like, it won't really matter)
  6. Once you've create the definition, you can add a control to the definition.  Make sure that you leave the Key field empty (so that your control will load by default), and select your control from the drop down.
  7. Once you've saved this, you should be able to drop your module on a page, and your control will be added.

Let me know if that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/14/2008 5:42 PM
 

Hi Brian,

Thanks for the guidelines. I did all that but am getting the following error when I go the page where I loaded the user Control

 

Error: TestUC is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type 'ASP.SampleUserControl' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. ---> System.InvalidCastException: Unable to cast object of type 'ASP.SampleUserControl' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

Any thoughts on this.

Thanks

IJ

 
New Post
4/15/2008 10:33 AM
 

Sorry about that, I didn't realize that module controls needed to inherit from PortalModuleBase.  Apparently, all controls in your module will need to inherit from DotNetNuke.Entities.Modules.PortalModuleBase in order to be able to be injected on to the page by DNN.

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/15/2008 12:34 PM
 

Brian

Thanks for the pointer. My user Control looks like

namespace TestUserControl
{
    public partial class TestUserControl : System.Web.UI.UserControl

.............

............

}

How can I include the inheritance from "DotNetNuke.Entities.Modules.PortalModuleBase" into this code. Would appreciate all help or hints

Thanks

IJ

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Adding a .Net user control into DotNetNuke as a ModuleAdding a .Net user control into DotNetNuke as a Module


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