Home » ASP.NET5 October 2007

Page.IsPostBack property: A solution to the client postback problem


There is a .aspx page with some textbox and a submit button.

User enters text in the textbox and clicks the submit button.

Then the system shows that the data has been successfully posted or updated.

But, when we view the database, the data just posted is not entered/updated there.


Use Page.IsPostBack property.

This property returns only a Boolean value: true if the page is being loaded in response to a client postback; otherwise, false. Default value is false.

More clearly:

1) IsPostBack returns false if the page is being loaded and accessed for the first time

2) IsPostBack returns true if the page is being loaded in response to a client postback.

Sample C# code:

private void Page_Load(object sender, System.EventArgs e)



// your code to update/insert into database



I had this problem when I was doing my semester project on ASP.NET and C#, one year back (well, at that time I had just started learning ASP.NET and C#). Then I googled the internet and found out about panel system (asp:Panel) in ASP.NET, i.e. using different panels to display and edit record/data. This took a lot of time to code and even manage the code and design as well. I had to write the same code twice. I found it very ineffective and again searched for a proper solution. Then I got to learn about IsPostBack property and all my hurdles were gone.




Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed

Comments are closed.