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?