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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogHow to add a web user control to a moduleHow to add a web user control to a module
Previous
 
Next
New Post
6/24/2007 6:39 PM
 

I know how to create a new module and install it. But how can I add a web user control to an existing module like Blog module in source code development level? The Blog module has 5 user controls, what if I want to add another user control? Is there any tutorial or instruction about it?

Thanks in advance for any help!

Brent

 
New Post
6/24/2007 7:52 PM
 

Brent,

Take a look at the .dnn manifest in the module. You will see how they are group together so that when adding the one module to the page 5 controls get added.

I am sure that will help.


Maxiom TechnologyAntonio Chagoury | Microsoft MVP
Maxiom Technology
Professional .net & DotNetNuke Solutions
web: www.maxiomtech.com
blog: www.cto20.com
twitter: @antoniochagoury & @maxiomtech

 
New Post
6/24/2007 8:37 PM
 

Antonio,
Thanks very much for your quick reply!

Here is what I did:

1. In visual studio right click on DesktopModules\Blog to add a Web User Control named "TestUserControl.ascx".
In the design mode I just added several labels and text boxes. The first line of the source is as follows:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="TestUserControl.ascx.vb" Inherits="DesktopModules_Blog_TestUserControl" %>

However I didn't want to have a code behind file as I just wanted to have the look and feel of the added web user control,
so I took out "CodeFile="TestUserControl.vb"". And when compiling it complained about "DesktopModules_Blog_TestUserControl". So I changed it to the following statement.

<%@ Control Language="VB" AutoEventWireup="false" Inherits="DotNetNuke.Modules.Blog.ViewBlog" %>

2. Added the following section to DNN_Blog.dnn

<module>
          <friendlyname>Test_UserControl</friendlyname>
          <cachetime>0</cachetime>
          <controls>
            <control>
              <title>Test User Control</title>
              <src>DesktopModules/Blog/TestUserControl.ascx</src>
              <type>View</type>
            </control>
          </controls>
</module>

3. Package all the relatives files into a zip file

4. In DotNetNuke installed the Blog module that I just zipped. In a test page I added the Blog module, it displayed all the five original user controls, but it puked about my user control as follows:

Error: is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Modules.Blog.ViewBlog.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---

So what would be the correct procedure to add my own web user control to the existing Blog module?

Thanks,
Brent

 
New Post
6/24/2007 9:44 PM
 

Brent,

You are close. At least you were able to add the 6th control to the module ;)

Now it only seems that you have to tweek the directive of the module.

Try by just putting this: <%@ Control %>

Let me know what happens.


Maxiom TechnologyAntonio Chagoury | Microsoft MVP
Maxiom Technology
Professional .net & DotNetNuke Solutions
web: www.maxiomtech.com
blog: www.cto20.com
twitter: @antoniochagoury & @maxiomtech

 
New Post
6/24/2007 9:50 PM
 

To be clear, the reason why you are getting a run-time error is because you are referencing the ViewBlog class (Inherits="DotNetNuke.Modules.Blog.ViewBlog"). That class will be looking for its user controls and try to inject data and modify their properties, but since your file(Test_blah.ascx) does not have any controls, then it throws the error you are seeing.

I hope this makes sense.


Maxiom TechnologyAntonio Chagoury | Microsoft MVP
Maxiom Technology
Professional .net & DotNetNuke Solutions
web: www.maxiomtech.com
blog: www.cto20.com
twitter: @antoniochagoury & @maxiomtech

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogHow to add a web user control to a moduleHow to add a web user control to 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