wanted to know the difference between Page.IsPostBack and Not page.IsPostBack.
what is the purpose of using these? where it is being used?
Page.IsPostBack is for forms that are runat="server". It is mostly used for same page validation, same page operations, ... anything really same page!
It is also used to help keep bandwidth and rendering times down.
The main reason why people use IsPostBack is to stop taping the databases everytime a request is made. If you are on your default page and just do work via that page, you can use the if Not page.ispostback then statements to populate information. When pages are posted back to the sever and then rendered back to the client, they don't have the need to repopulate the information since it was just populated. It is all kept in the viewstate and read back without using precious resources on the server.
It's a very good and handy tool to know, and very easy to know as well! Any information that is not variable dependant should be only posted when the user first shows the page.
For another example, let's say you are using menus that pull information from the database, articles that are previewed on a side bar for users with a link to the full article, and a search function that posts results that can be ordered by date, name, etc. Now, with the IsPostBack functionality, you can add the statement to all information that does not change when a request is made on the same page. You can add the "If Not Page.IsPostBack Then" for the menus and articles since the information does not change in anyway when a user clicked to have the search results ordered by name! This means that you do not have to tap the database three times, but only once! The information about the menus and articles are held in the viewstate so you don't have to repopulate them.
Then for the "If Page.IsPostBack Then" statement, you can use for registration purposes for your site, post comments, etc. all by the Page.IsPostBack function. No code in the "If Page.IsPostBack Then" statement is fired when the page is requested by the client for the first time; And vice-versa, the "If Not Page.IsPostBack Then" function is only fired when the page is called for the first time, then uses viewstate to fill in the areas it is required to for every postback after that.
Hope this helps..
Page.IsPostBack Is used to check if the user posted back to the page. Meaning they clicked a button or changed a field in the form that causes it to post back to itself.
Putting Not usually is used to check the initial load of the page.
You only need to fill databound fields on the initial load, so you put all your databinding code in the Not page.IsPostBack. The values are saved in the viewstate and can only be read by the form if it gets posted back to itself.
So, if it is a postback dont do databinding if its not a postback do databinding.
Thanx alot for the help...
The given information about if (!Page.IsPostBack) is really good.
!!!!!!! Thanks a lot !!!!!!!!!
Well page, IsPostBack is gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback, if you are using the datagird, then the not postback means it will not postback the page that means it will not have any changes in the data-grid, and the page. IspostBack means the page is postback when any changes made in datagrid.
thanks very much for the information. as it was very useful at the starting instance for anyone who is new to page.ispostback. :)
Sir I have these codes
and autocomplete.php has ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
I'm working in Excel to extract content of a table from a web page and populate Excel sheet cells with it. I'm trying to extract data from a table that gets loaded to a web page after show results method gets called. I have an error that says "Run-time error ...