我试图编写我自己的DNN 7模块,以了解。我是this tutorial。DNN 7错误自定义模块
我创建了该模块,并显示此错误。
Error: HelloWorld 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.UI.Modules.ModuleHost.LoadModuleControl()
--- End of inner exception stack trace ---
这里我的ascx代码
<%@ Control Language="C#"
AutoEventWireup="true"
CodeFile="HelloWorld.ascx.cs"
Inherits="DesktopModules.HelloWorld"
%>
<h1>Hello Dude</h1>
<p>Some text here</p>
而且我ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke.UI.Modules;
namespace MyModules
{
public partial class HelloWorld : ModuleUserControlBase
{
}
}
搜索在谷歌链接我下面的代码,但我不知道这是解决方案(并且不知道如何正确使用它)
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
看看这个链接。我现在使用这个模板多年来创建模块,它工作得很好。 http://dnntcmsbuild.codeplex.com/documentation – JK84 2015-02-06 10:09:33
@ JK84:Thanx,但我不想使用模板。 – 2015-02-06 14:24:19