uma.n
uma.n

Reputation: 89

asp.net page_Load event

my page_load() event is being called twice when my page is loaded.can anyone help me out regarding this? I came to know that if AutoEventWireUp is set to true this happens but that is not the issue here.I even checked it by making the AutoEventWireUp set to false but of no use.I even came to know that if the image tag's src is not specified the page load will be called twice.But no where in my page the image tag src is empty. What might i be missing?

Upvotes: 1

Views: 894

Answers (1)

Glory Raj
Glory Raj

Reputation: 17691

It is not you calling the page load function twice, that is the way ASP.NET works. The page posts to itself, thus calling the page_load function, when any Server controls on the page are fired (those which as set to postback).

you can check like this...

if(!IsPostBack) 
{  
    //Code when initial loading 
}
 else 
{ 
// code when post back 
}

taken from here page load is firing twice in asp net page

I hope it will helps you

Upvotes: 2

Related Questions