Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can we identify that the Page is Post Back?

user-image
Question ajoutée par Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date de publication: 2013/01/22
marwa khalaf
par marwa khalaf , .Net Developer , Sands National Academy

Page object has an "IsPostBack" property, which can be checked to know that is the page posted back.

Furqan Ul Karim
par Furqan Ul Karim , Senior Delivery Manager (Contract) , Virgin Red

Page's IsPostBack property in asp.net.
you can also figure out by checking the value for the hidden control __EVENTTARGET and __EVENTARGUMENT where __EVENTTARGET contains the control id caused the postback and later one will hold the value

if (basename($_SERVER['HTTP_REFERER']) == $_SERVER['YOUR_SCRIPT_NAME']) { // DO SOMETHING }

Hazem Salama
par Hazem Salama , Senior Member of Technical Staff , Verizon Communications

Page.IsPostBack method

Rahul. K Nair Chaithrakam
par Rahul. K Nair Chaithrakam , Senior Software Engineer , Emirates airlines

With the help of “IsPostBack” property In Asp.net we can check if a page is rendered for the first time or responding to a post back.

Eg:

            protectedvoid Page_Load(object sender, EventArgs e)

                {

                if (!IsPostBack)

                {

                    // Can write code here or call the method you want

                }

 

                if (IsPostBack)

                {

                     //Can write code here or call the method you want

                }

 

                }  

Page object has an "IsPostBack" property, which can be checked to know that is the page posted back to server or not, if "IsPostBack" property is "True" then page called postback and page loading through the "Post" Request (page loading second or higher time) else if "IsPostBack" property returns false then page is loading through "Get" Request (page loading first time).

Rani Alomari
par Rani Alomari , Full Stack .Net Developer , Jordan Center for Diseases Control (JCDC)

by checking the control's property 'IsPostBack'

Mohammad Ibrahim Rashid
par Mohammad Ibrahim Rashid , IT Consultant (Information Technology Consultant) , SABIC Petrochemicals

In Page_Load Event of your page you can test "IsPostBack" Property of your page instance.

Maher Alsilwy
par Maher Alsilwy , CONSULTANT , B7R DESIGN WWW.B7RDES.COM

in the Page_Load Event check this condition if(isPostBack == false) { // here your code }

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?