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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problems with module Page_Load firing twiceProblems with module Page_Load firing twice
Previous
 
Next
New Post
11/27/2007 4:22 PM
 

I know this has been an issue before but all of the resources I have found relating to solutions have not worked. Maybe someone here can throw in some ideas. I have a new module that I am creating for DNN 04.06.02. The module only has a View control defined. Here is the user control:

ViewTest.ascx:
<%@ Control language="vb" Inherits="Agnitek.Modules.BlakemanWebForm.ViewBlakemanWebForm" CodeFile="ViewBlakemanWebForm.ascx.vb" AutoEventWireup="False" Explicit="True" %>

ViewTest.ascx.vb:
Namespace OurCompany.Modules.Test
    Partial Class ViewTest
        Inherits Entities.Modules.PortalModuleBase
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not IsPostBack Then
                Dim temp As New LinkButton
                temp.CommandArgument = 1
            End If
        End Sub
    End Class
End Namespace

When viewing this module, the Page_Load Sub runs twice. I previously had server controls on the page and when they would cause a postback, the first time Page_Load is called IsPostBack = true but the second time through IsPostBack=False. This wreaks havoc on my code so I need to figure out why/how I am getting two Page_Load fires.

I have also tried overriding OnInit and OnLoad as follows but these are both called twice as well:
Namespace OurCompany.Modules.Test
    Partial Class ViewTest
        Inherits Entities.Modules.PortalModuleBase

        Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
            MyBase.OnInit(e)
        End Sub

        Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
            MyBase.OnLoad(e)
            If Not IsPostBack Then
                Dim temp As New LinkButton
                temp.CommandArgument = 1
            End If
        End Sub
    End Class
End Namespace

Any ideas on what to do next?

 
New Post
11/28/2007 10:44 AM
 

Can anyone suggest whether this is more likely an ASP.NET issue or a DotNetNuke issue?

 
New Post
11/28/2007 11:48 AM
 

Are you sure that the page isn't being requested twice for other reasons?  A neat tool to use is microsoft Fiddler, which allows you to watch all requests and responses as they are communicated between your web browser and server.

I had this issue once and it took me FOREVER to figure out that the authentication provider was setting a variable and then issuing a redirect; upon the next load the variable was already set and so it did not redirect but returned the page.

 
New Post
11/28/2007 1:37 PM
 

I also ran into something similar when an image was being rendered with response.write in a control I adopted (in part) from a howto article.  Each time the response.write was called a post event fired.   I ended up working around it by setting a flag on and off when I needed to ingore the post event.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problems with module Page_Load firing twiceProblems with module Page_Load firing twice


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