Hi all,
I am very new to DNN as well as developing modules for it. I could use some help here. I've read the module developers guide, the tutorial on www.asp.net forum and the tutorial on adefwebserver.com.
I am having problems in the main creation of a module. I am using DNN 4 and Visual Studio 2005.
I've created a module with the help of the starter kit. Now, for testing purposes, I wanted to create a dropdownlist that fetches data form a sql table. the table is created as well as the procedure and the files in the lower layers are also correct (below the UI layer). The problem is in the ViewTestModule.ascx and ViewTestModule.ascx.vb. The template generated a simple asp:label that show some sample data from the database, that works fine. As I mentioned before, I wanted now to create a drop down list that shows the same sample data as the label.
I created the <asp:DropDownList ID="ddlTestCbo" runat="server" /> just below the already existing asp:Label. I went to the ViewTestModule.ascx.vb file and altered a bit the Page_Load method:
ddlTestCbo.DataSource = colTestModule
ddlTestCbo.DataValueField =
"ItemID"
ddlTestCbo.DataTextField = "Content"
ddlTestCbo.DataBind()
Now, the VS05 is telling me that the ddlTestCbo is not declared. So I declared it as
Protected WithEvents ddlTestCbo As System.Web.UI.WebControls.DropDownList
Now the code is "correct". So I try to run the module and I get the following error:
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 YourCompany.Modules.TestModule.ViewTestModule.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---
Then I went back to the .ascx file and at the top I changed CodeFile="ViewTestModule.ascx.vb" to Codebehind="ViewTestModule.ascx.vb". In the ViewTestModule.ascx.vb file I was allowed to use the ddlTestCbo without declaring it. So I ran the module again, and recieved a new error:
MinMax persistance type of cookie requires a ModuleId
So, I changed back to CodeFile="..." and comented away all of the dllTestCbo. Ran the module and it worked but only with a sample label and an empty DropDownList :(
What am I doing wrong here? I just can't seem to get this stuff working at all and it is starting to get extremely frustrating. If anyone could please help me out, I would be very gratefull!
Thanks in advance