Some options on ASP. NET page for prompt judgment

Source: Internet
Author: User

Some options on the asp.net page are prompted for judgment. For example, when saving a piece of information, you need to judge whether the current information is empty. The following two conditions are described. Use the ext control and asp control for analysis. if it is an asp control, you must obtain the id of the current control when prompted. You can obtain the id of the corresponding option by querying the source code. 2. If it is an ext control, prompt a certain option to directly obtain the id of the control in the aspx design. Use the following js functions to prompt. <Script language = "javascript"> function YANDNCheck () {if (document. getElementById ("txtName ")! = Null) {if (document. getElementById ("txtName"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("txtName "). focus (); return false ;}}return true ;}</script> 1: Judgment information of the asp control <script language = "javascript"> function YANDNCheck () {if (document. getElementById ("the current textbox id in the source code ")! = Null) {if (document. getElementById ("Current textbox id in source code"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("the current textbox id in the source code "). focus (); return false ;}}return true ;}</script> front-end display of the asp control <table> <tr> <td> Name: </td> <asp: TextBox id = "txtName"/> <td> <asp: Button onClientClick = "return YANDNCheck (); "/> </tr> </table> type 2: ext control judgment Information <script language =" javascript "> function YANDNCheck () {if (document. getElementById ("txtName ")! = Null) {if (document. getElementById ("txtName"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("txtName "). focus (); return false ;}}return true ;}</script> ext control foreground display information: you can directly call the id of the corresponding control <table> <tr> <td> name: </td> <ext: textBox id = "txtName"/> <td> <ext: Button onClientClick = "return YANDNCheck ();"/> </tr> </table>

Related Article

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.