Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModules Run Twice! - Why? How to stop it.Modules Run Twice! - Why? How to stop it.
Previous
 
Next
New Post
6/26/2010 1:31 PM
 
I have written 3 modules so far and taken many samples from other coders in both MVP and MVC format.  I noticed as any of these modules run they actually do everything twice.  They seem to start 2x.  I thought this was a bug in trace/debug from VS2008, but I noticed it even fails twice if I don't have debug on.  I can find no earthly reason why it is doing this, so I am looking for you help.  An example of a failure (I do not need a solve of the failure, but it is proof that the module is executing twice.  Please help.

Error Error: QHWeb Term 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 QHWeb.Modules.Term.View.get_thisTermType() in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 39 at QHWeb.Modules.Term.View.BindData(String SearchText) in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 61 at QHWeb.Modules.Term.View.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 146 --- End of inner exception stack trace ---

Error Error: QHWeb Term 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 QHWeb.Modules.Term.View.get_thisTermType() in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 39 at QHWeb.Modules.Term.View.BindData(String SearchText) in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 61 at QHWeb.Modules.Term.View.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\dotnetnuke\DesktopModules\QHWeb\Term\View.ascx.cs:line 146 --- End of inner exception stack trace ---


Again, I do NOT need to fix the error above, it is just proof that the modules are running twice.  All of them from anyone.
Paul
 
New Post
6/28/2010 2:23 AM
 
Are you developing in C#? In your oninit do you have the base doing a load as well? I've found this to cause page_load to fire twice.

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
6/28/2010 10:08 AM
 
Chris,
 Thanks.  I am glad it is you responding.  I like your c# model (related and posts) - Thanks.   I have been coding in C# lately, but my first two were in VB.  Here is the latest C#.  If you see the cause, let me know. 

override protected void OnInit(EventArgs e)

{

InitializeComponent();

base.OnInit(e);

}

private void InitializeComponent()

{

this.Load += new System.EventHandler(this.Page_Load);

ddlRecordsPerPage.SelectedIndexChanged += new EventHandler(ddlRecordsPerPage_SelectedIndexChanged);

btnSearch.Click += new System.Web.UI.ImageClickEventHandler(btnSearch_Click);

}

private void Page_Load(object sender, System.EventArgs e)

{

try

{

if (Request.QueryString["CurrentPage"] != null)

CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]);

else

CurrentPage = 1;

if (Request.QueryString["filter"] != null)

strFilter = Request.QueryString["filter"];

else

strFilter = "%%";

if (!Page.IsPostBack)

{

if (Request.QueryString["PageRecords"] != null)

ddlRecordsPerPage.SelectedValue = Request.QueryString["PageRecords"];

BindData(strFilter);

}

}

catch (Exception exc)

{

Exceptions.ProcessModuleLoadException(this, exc);

}

}

 
New Post
6/28/2010 7:13 PM
 
Hi Paul,

A couple of ideas based on the code you posted;
  1. In your OnInit event call base.OnInit before your own code.
  2. Don't name manually attached event handlers with the default system names, for example, your method Page_Load I would name MyClass_Load.
Have you checked that you have set AutoEventWireup="false" in the .ascx file?

Good luck,
Rhys


www.rmjcs.com - Mostly SQL Server Stuff
 
New Post
6/28/2010 7:37 PM
 
It's #1 from Rhys' suggestion, swap the order. That's what I was thinking of, I just didn't word it well in my original reply :D

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModules Run Twice! - Why? How to stop it.Modules Run Twice! - Why? How to stop it.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out