When to use the asynchronous Web method

Source: Internet
Author: User

I remember that javascript is often used when asp is used. Such as the verification form and deletion confirmation. Asp. Net is a server, and our javascript has lost the space for applications. However, after some exploration, Asp. Net uses javascript very easily.
First, we will introduce the webbutes attribute of WebControl. (HtmlControl is similar and does not repeat). Attributes is a set of arbitrary features (only for rendering) that do not correspond to the properties of the control. For example, a common form Control
<Input type = "button" name = "Button" value = "Button" onClick = "ClickEvent ()">
Here, the type, name, and Button are all the attributes of the Button, and the event after The onClick Button is clicked. These can be set in Asp. Net through the Attributes attribute set.


The following is an example of Logon form verification.
<% @ Page Language = "C #" %>
<Script runat = "server">
Void Page_Load (Object sender, EventArgs e)
{
// Add the client onClick event
Button1.Attributes ["onClick"] = "return CheckForm ()";
}
</Script>
<Html>
<Head>
<Script language = "javascript">
Function CheckForm ()
{
// Verify the javascipt function of the form.
If (document. all. Username. value = "")
{
Alert ("Enter the user name ");
Return false;
}
Else if (document. all. PassWord. value = "")
{
Alert ("enter the password ");
Return false;
}
Return true;
}
</Script>
</Head>
<Body>
<Form runat = "server">
<Br/>
<Table height = "150" width = "300">

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.