开发者

Custom class in DotNetNuke Module

开发者 https://www.devze.com 2023-02-18 15:51 出处:网络
I know this can be done as there are other modules out there that have this, but I\'m just not getting it to work.

I know this can be done as there are other modules out there that have this, but I'm just not getting it to work.

I have created a custom module for a DotNetNuke site. I want to be able to create a class object within the module to hold the information about that object. I can create the object and everything complies. But when I go to use the object in the code-behind it states that the object is not defined. I'm not really sure where to go from here.

This is the beginning of the View.ascx.vb :

Namespace Modules.VacationForms

Public MustInherit Class View
    Inherits PortalModuleBase

This is the object class beginning:

Namespace Modules.VacationForms

Public MustInherit Class Vacat开发者_运维知识库ion

I'm really not sure why this is not working. I did download another module code to compare and as far as I can tell everything is the same. Any help is appreciated.


Are you using a Web Site Project or a Web Application Project? The Web Application project will allow you to compile all of your code together (the only issue here might be the the Root Namespace setting in your project, but, assuming both classes are in the same project, that shouldn't be it). If you're in the Web Site project (e.g. developing directly in the DNN solution), then your code won't get compiled in the traditional sense, but will be on-demand compiled by DNN. It only does that for code behind files associated with requested controls/pages (e.g. your View.ascx.vb) and code files in the App_Code folder. I would guess that your hangup is that your Vacation class' code file isn't in the App_Code folder.


It looks you are not using the Web Application Project for module development. Easiest thing to do is install module development templates (from dotnetnuke.codeplex.com download starterkit package of your dnn version).

If your module is too simple and you don't want to do that, OR you don't want to install the templates in your pc, you can do following:

  • If you are using a vs version that is not using WAP by default, get the installation from web.
  • create a new folder for your dnn module in DesktopModules directory in root
  • add a new WAP project in that folder.
  • remove web.config from that folder, go to properties and point build output director to your dnn site's bin directory (../../bin will work most of the time)
  • Once you are done with that, all your code will start working as expected.
  • Good thing about this is, all your .vb and .ascx.vb files will be compiled in a single dll that you can distribute as a package easily.

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号