Search code examples
c#asp.netdotnetnukedotnetnuke-module

Creating a C# Module in DNN


I want to embed a C# class in a module so that I can call the functions using buttons and click events. I have no idea how to do this. I've managed to write the class I want to use, but where do I put the code? I created a module in DNN and got this:

<%@ Control Language="C#" ClassName="MailingSystem" Inherits="DotNetNuke.Entities.Modules.PortalModuleBase" %>
<h1>Congratulations</h1>
<p>You have successfully created your module.  You can edit the source of the module control by selecting the View Source Action from the Action Menu.</p>

<script runat="server">

</script>

I can't put my code in here, I get all sorts of errors about namespaces not allowed, can't import classes with "Using", and so on. So what am I supposed to do? My class is working, I just need to wrap it in a module and put it on a DNN page.


Solution

  • It is better to start with a DotNetNuke Module Template, like this one. It isn't as easy as creating an aspx page.