Ispostback usage, page. isvalid usage

Source: Internet
Author: User
Ispostback
If ispostback is loaded for the first time, the value is true.
However, if you click a button in the future, pageload will be executed again, because PostBack will be triggered. This is true.
So if (! Ispostback) placed in {} CodeIt should be the first load to run. Code that does not run at other times.
Page. isvalid
In ASP. NET, a verification control is provided to verify the input data of the form for convenient form verification. The root cause of the problem is that ASP: button controls are verified by default when you click.
Some users want to have two buttons in the form. Some of the buttons do not have to be verified, but they must also be verified by default. ProgramIt causes a lot of troubles in design.
Solution: When verification is required, you can manually call the verification code: Verify the control. Validate () or page. Validate () for verification.
Isvalid is the property of the page. It is used to determine whether all verification controls on the page have passed verification. If there is no verification control on the page, this judgment is unnecessary.
Page. ispostback: code first loaded and run in page_load
Page. isvalid: Verify in onclick in BTN...

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.