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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule aspx to ascxModule aspx to ascx
Previous
 
Next
New Post
1/28/2011 12:56 PM
 
Kelly Edvalson wrote:
The "inherits" tag in your ascx file needs to be the name of the class in your codebehind. It would look something like this
<%@ Control Language="VB" ClassName="Test" CodeBehind="View.ascx.vb" Inherits="MyProjectNamespace.DesktopModules_Test_View" AutoEventWireup="true" %>

Hi Kelly

Sorry to be a pain and come back again. Please excuse me, I haven't used VB in 15 years (I've been living in Delphiland) and someone changed it while I was away! :)

I've done all that, sort of. I *thought* my namespace was going to be 'DotNetNuke', but it doesn't like that or anything else I put. I'm getting 'Error 118 Could not load type DotNetNuke.'DesktopModules_Test_View', or whatever I put as namespace. If there's one defined in some project setting somewhere, I can't find it. I've looked through web.config and have these listed:

<add namespace="System.ComponentModel"> <add namespace="System.Data"> <add namespace="System.Data.SqlClient">
<add namespace="System.Drawing"> <add namespace="Microsoft.VisualBasic"> <add namespace="System.Globalization">
<add namespace="DotNetNuke.Services.Localization"> <add namespace="DotNetNuke.Entities.Users">
<add namespace="DotNetNuke"> <add namespace="DotNetNuke.Common"> <add namespace="DotNetNuke.Data">
<add namespace="DotNetNuke.Framework"> <add namespace="DotNetNuke.Modules">
<add namespace="DotNetNuke.Security"> <add namespace="DotNetNuke.Services">
<add namespace="DotNetNuke.UI"> <add namespace="DotNetNuke.Entities.Portals">
<add namespace="DotNetNuke.Common.Utilities">
<add namespace="DotNetNuke.Services.Exceptions">
<add namespace="DotNetNuke.Entities.Tabs">

Am I missing a line, or something, - besides a clue or two, that is?
Make sure that your code behind file is actually named "View.ascx.vb" also.

Yes, it's that.
One more thing, your partial class is the one that needs to inherit the portalbase. So instead of this:
 "Partial Class DesktopModules_Test_View  Inherits System.Web.UI.UserControl"
you need this "Partial Class DesktopModules_Test_View    Inherits DotNetNuke.Entities.Modules.PortalModuleBase"

 Thanks, I'll file this post away for the next time, if there is one. I'm doing a favour for a friend by trying to put this thing together, though I could get to like it if the learning curve wasn't quite so vertical. :)

Many thanks for your help, I really appreciate it.

Cheers

Ian

 
New Post
1/28/2011 4:09 PM
 
DotNetNuke core is built with the namespace 'DotNetNuke'. You shouldn't try to put your modules in that namespace. A namespace should be unique to your project/solution/code. You can name your namespace whatever you want.

On a side note, how are you using this ascx file? Is it inside of a module solution in Visual Studio that would generate a dll upon compile? Is it a stand alone usercontrol which you plan to inject on the page somehow?
 
New Post
1/29/2011 12:18 AM
 
Kelly Edvalson wrote:
I would recommend getting an example module to compare against to see how it all ties together. I would download this visual studio module template, create a new module and look at how it sets it up, then change your structure to be similar.
http://www.bitethebullet.co.uk/VS2010_DNN_Template.aspx

Seeing a basic module as an example is very helpful if you are new to creating modules.

 
I've downloaded that. Thanks. Perhaps I should use a template instead of creating a module from DNN Host. I assumed that Module Definitions|Create New Module|New would give me the basic framework . I ran what it gave me, and it worked, I copied and pasted my bits inside, and it didn't. 

The problem, for me, with using the template (I've played around with the already installed ones several times over the last couple of weeks) is the 'YourCompany' bit. I didn't particularly want to use that but also didn't know all the correct places to change it. I did a bit of research on changing it and couldn't find anything of any use. The only source that I found, that told me what I needed to do, recommended a global Find & Replace on YourCompany. It changed 50+ instances and resulted in yet another reinstall of DNN. So, I was trying to find the easiest route, which to me, was to let DNN create the thing and then plug in my bits, once they worked in an aspx.

I don't know where your other reply went. I got notification in my Gmail but it doesn't show up here. I'll paste it in and reply.

DotNetNuke core is built with the namespace 'DotNetNuke'. You shouldn't try to put your modules in that namespace. A namespace should be unique to your project/solution/code. You can name your namespace whatever you want. On a side note, how are you using this ascx file? Is it inside of a module solution in Visual Studio that would generate a dll upon compile? Is it a stand alone usercontrol which you plan to inject on the page somehow?


I appreciate I can name it anything; I thought it had already been named by DNN when it created it, as it all ran ok 'out of the box'. Where is the name stored? I've been through everything I can find online (obviously in the wrong places) and can't find anything on where to find the namespace name to set or change it.

In answer to your questions; it is sitting in a folder under Desktop Modules, where DNN created it. And it is just a bespoke data-entry form.

Cheers

Ian



 
New Post
1/29/2011 1:07 AM
 
For the record, done it, problem solved.

I threw away what I had, followed the example at http://www.adefwebserver.com/DotNetNukeHELP/DNN_ShowMeThePages/Default.htm (which I must have done 20 times already in the last couple of weeks), pasted in my bits and it worked.

Many thanks for all your help Kelly. I really appreciate your time and efforts. All I've got to do now is remember where I got to before I got stuck on this bit. :)

Cheers

Ian
 
New Post
1/31/2011 3:51 PM
 
Hi Ian.

Maybe you might have also a look at this good tutorial for a "quick win". Starting from there it is a little bit easier to design your own ideas....

You can find a pretty good step by step tutorial at Johans Site here

Cheers

Kai
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule aspx to ascxModule aspx to ascx


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.