Page_Load is firing twice in ASP.NET page

前端 未结 16 1495
闹比i
闹比i 2020-12-08 09:57

Asp.net page_load function is loading twice.. hence it affects my page performance. Does anyone know the reason it is loading twice.

No, iam not calling the page loa

相关标签:
16条回答
  • 2020-12-08 10:19

    I solved my issue by setting the AutoEventWireUp attribute to FALSE. I got this issue when migrating from .net 1.1 to .net 4.0. Somehow VS2012 reset this attribute to TRUE when I copy the file over from the older version.

    0 讨论(0)
  • 2020-12-08 10:19

    For me it was solved by removing

    Handles Me.Load 
    

    and changing the method like

    Protected Overrides OnLoad(...)
    
    0 讨论(0)
  • 2020-12-08 10:20

    The Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded. The Load event of individual controls occurs after the Load event of the page.

    Use the OnLoad event method to set properties in controls and to establish database connections.

    Reffer MSDN: enter link description here

    0 讨论(0)
  • 2020-12-08 10:20

    I had the same issue. It was because of a TreeNode with ImageUrl="".

    0 讨论(0)
  • 2020-12-08 10:22

    For me I could get around this calling multiple times by using the PreRender event instead

    protected override void OnPreRender(EventArgs e)

    This is only called once, even if the onload's and init's are called a million times.

    0 讨论(0)
  • 2020-12-08 10:25

    Please find the solution here........

    1. Check if the Load events have Handlers for Base class and the child class Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load**

    2. If it is just Remove the Me.Load from the event , now check your page. Hope this may be useful and solve your issue.

    0 讨论(0)
提交回复
热议问题