Results 1 to 2 of 2

Thread: Page_Init and Page_Load getting called twice

  1. #1
    Senior Member codenamevirus's Avatar
    Join Date
    Jun 2005
    Location
    Faridabad, Haryana, India
    Posts
    298

    Question Page_Init and Page_Load getting called twice

    Hi

    I have web application that uses a lot of user controls.

    The problem i m facing is, the page_init and page_load events are getting called twice before the page gets rendered.

    I tried searching on google, and found out that setting the AutoEventWireup="False" would solve the problem, but when i do this, the events are not called even once.

    what should i do???
    CodeNameVirus

  2. #2
    Senior Member mungyun's Avatar
    Join Date
    Apr 2004
    Location
    Illinois
    Posts
    172
    Basically what autoeventwireup does is allow you to either manually bind events or allow VS to do it for you. if it is set to true then VS will add the Button1_Click() event for you and if it is false, you will have to bind it yourself.

    Is any of your controls set to autopostback on change? For example, if you have a textbox that is set to postback when you hit enter and you click the submit button. that can cause it to be hit twice.

    another possibility is that if you have a page passing control to another page by using server.transfer instead of response.redirect could yield your double init and load
    I believe in making the world safe for our children, but not our children’s children, because I don’t think children should be having sex. -- Jack Handey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •