Asp. Use of script Runat server in net _ practical tips

Source: Internet
Author: User

This article describes the <script runat= "server" in asp.net in the use of >, share to everyone for your reference. Specifically as follows:

In the asp.net. aspx page, you can add code in the Cases:

Copy Code code as follows:
<script type= "Text/javascript" runat= "Server" >
void Select_change (Object sender, EventArgs e)
{
Response.Write ("select changed!");
}
</script>

As you can see, you can also use server-side Response.Write () to output content.

It should be noted that <script runat= "Server" > </script> can only place methods and properties, and not directly add statements and expressions.

In addition, in an. aspx page, you can also use the <%%> tag to refer to a server-side variable, or to display a server-side function return value to the client. However, the use of this tag has certain limitations, in which the function or subroutine cannot be declared, and only statements can be placed.

In practical applications, it is best to separate the front and back code, so that not only can make the code clear, easy to manage, but also fully embodies the asp.net and ASP differences.

I hope this article will help you with the ASP.net program design.

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.