Register now or log in to join your professional community.
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).