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?
-
2can you show your markup page (aspx) and codebehind (aspx.cs) ?Davide Piras– Davide Piras2011-11-11 10:20:12 +00:00Commented Nov 11, 2011 at 10:20
-
hi.. sorry actually we r not supposed touma.n– uma.n2011-11-11 10:23:38 +00:00Commented Nov 11, 2011 at 10:23
-
If you check with Fiddler2, is the page actually loading twice (i.e. are there two HTTP requests to it)?mjwills– mjwills2011-11-11 10:28:18 +00:00Commented Nov 11, 2011 at 10:28
-
i do not have idea regarding "Fiddler2"... there are no two HTTP requestsuma.n– uma.n2011-11-11 10:35:55 +00:00Commented Nov 11, 2011 at 10:35
Add a comment
|
1 Answer
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