How does. Net implement the page. ispostback attribute? Let's take a look at the ispostback explanation in C #.

Source: Internet
Author: User

I went to a Shanghai company for an interview last month. I had a question in the written examination:How does. Net implement the page. ispostback attribute??

I did not know how to answer questions after reading it for a long time. I want to write countlessProgramIn Aspx. CS, write if (! Ispostback) countless, but never thought about this problem.

Today, g.cn found the following:ArticleAccording to the tests on the recently developed online shopping guide for women, we can see that. Net checks whether the page is opened for the first time based on whether request. Form. Count is greater than 0.

The original article is as follows:

Description of ispostback in C #

Page. ispostback indicates whether the current request is opened for the first time.

1) loadCodeIn ispostback, you only need to load the code once and put it in if (! Ispostback.

2) Usage

If (! Ispostback)
{
Response. Write ("first submission! ");
}
If (ispostback)
{
Response. Write ("press the button! ");
}

3) ispostback is only false when it is enabled for the first time, and true when it is used for other times.

4 ). net: request. form. count = 0 is the first time to open, ispostback = false; request. form. count> 0 is not the first time to open, ispostback = true;

5) each time the user returns any information to the server, the ispostback attribute is triggered to determine whether the user has logged on or other events.

6) it is the first time that a URL is opened through the address bar of IE. When a server submits a URL through the submit button on the page or the button that can cause the submission in post mode, the page is no longer opened for the first time.

Write down this article to commemorate the interview that was out.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.