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?
Asked
Active
Viewed 869 times
1
-
2can you show your markup page (aspx) and codebehind (aspx.cs) ? – Davide Piras Nov 11 '11 at 10:20
-
hi.. sorry actually we r not supposed to – uma.n Nov 11 '11 at 10:23
-
If you check with Fiddler2, is the page actually loading twice (i.e. are there two HTTP requests to it)? – mjwills Nov 11 '11 at 10:28
-
i do not have idea regarding "Fiddler2"... there are no two HTTP requests – uma.n Nov 11 '11 at 10:35
1 Answers
2
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