Click to See Complete Forum and Search --> : PageOnLoad
kirantoday
October 5th, 2006, 04:35 AM
Hi ,
Iam new to ASP.net
On my web form, I placed a command button
When I run the application,Whenever I click on Click on command button, the PageOnLoad function is called.
I want this PageOnload to be called only on the loading page but not for every click of the command button. Can I do this without using any flag.
can someone help.
thanks
k
Shuja Ali
October 5th, 2006, 04:50 AM
ASP.NET page has its own lifecycle. Whenever a postback happens, the page goes through the same lifecycle again. This is why before triggering your click event, the pageload event handler gets executed.
If you want that code written in Page_Load event shouldn't get executed after you postback the page then you should use If Not IsPostback
'your code
End If
cykophysh
October 5th, 2006, 08:30 AM
Hi ,
Iam new to ASP.net
On my web form, I placed a command button
When I run the application,Whenever I click on Click on command button, the PageOnLoad function is called.
I want this PageOnload to be called only on the loading page but not for every click of the command button. Can I do this without using any flag.
can someone help.
thanks
k
You need to understand the Page Lifecycle to fully understand what you are trying to implement here.
Try reading through these articles first
http://www.15seconds.com/issue/020102.htm
http://www.aspfree.com/c/a/ASP.NET/ASP.NET-Life-Cycle-and-Best-Practices/
http://www.startvbdotnet.com/aspsite/forms/formlifecycle.aspx
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.