我試圖編寫我自己的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