Page_Load executing twice, autoeventwireup set to false

Posted on 2006-05-22
Last Modified: 2008-02-01
Hi All

I have smartnavigation turned off (have tried with it on), and AutoEventWireup set to false (have tried with it on too). I also have .Net Framework v1.1 with SP1 installed.

my page checks for a link parameter (form_id) on the load, if is is null it will open for a new entry, if not it will search for the form_id details and fill out the page for someone to approve / reject.

By default the page loads as \\server\eforms\nocharge.aspx
When using a parameter, normally accessed through a link, it opens as \\server\eforms\nocharge.aspx?form_id=10000

page load only gets called twice when there is a parameter in the link. This happens for all events (ie: clicks etc) when the parameter is present. if the link is the default version, it works fine and page load is only called once.

How could a parameter in a link be causing the page_load to execute twice, the second time not registering as a postback?

Shortened Sample Code:

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
    End Sub

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Me.IsPostBack Then

            'Code Here

        End If
    End Sub

HTML Header:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="nocharge.aspx.vb" Inherits="eforms.nocharge"%>

Question by:JHankinson
    LVL 17

    Expert Comment

    try puttin off the "Handles MyBase.Load"

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
            If Not Me.IsPostBack Then

                'Code Here

            End If
        End Sub

    Author Comment

    ok i just tried that, now the page_load doesnt get hit at all

    i tried it with autoeventwireup set to true, that makes it hit the point, but it runs through twice again

    Author Comment

    i have fixed the problem

    it was caused by one of my <td> tags containing a background="#000000" tag, where it should be bgcolor="#000000"

    no idea how it got there

    someone please close this question

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now