Asp. NET page some options to determine specific implementation _ practical skills

Source: Internet
Author: User
The following are divided into two different cases. Analysis by using the Ext control and ASP's controls respectively
1. If it is an ASP's control, you need to get the ID of the current control when you are prompted, and you can get the corresponding option by querying the source code
's ID.
2. If the control is ext, make a prompt for an option to directly get the ID of the control in the ASPX design.
It is prompted by the following JS function.
Copy Code code as follows:

<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("txtname")!= null) {
if (document.getElementById ("Txtname"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById ("Txtname"). focus ();
return false;
}
}
return true;
}
</script>


The first: The evaluation information of ASP control
Copy Code code as follows:

<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("ID of the currently corresponding textbox in Source code")!= null) {
if (document.getElementById ("ID of the currently corresponding textbox in Source code"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById (ID of the currently corresponding textbox in the source code). focus ();
return false;
}
}
return true;
}
</script>

foreground display of ASP controls
Copy Code code as follows:

<table>
<tr>
<td> name:</td>
<td><asp:textbox id= "Txtname"/>
<td><asp:button onclientclick= "return Yandncheck ();" />
</tr>
</table>

The second type: the Judgment information of ext control
Copy Code code as follows:

<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("txtname")!= null) {
if (document.getElementById ("Txtname"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById ("Txtname"). focus ();
return false;
}
}
return true;
}
</script>


Ext Control foreground Display information: directly call the corresponding control's ID
Copy Code code as follows:

<table>
<tr>
<td> name:</td>
<td><ext:textbox id= "Txtname"/>
<td><ext:button onclientclick= "return Yandncheck ();" />
</tr>
</table>

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.