TAILIEUCHUNG - aspnet sample_part4

Chương 1: Giới thiệu cho NET và . C # File: Trang đầu tiên của tôi được bảo vệ void Page_Load (Object s, EventArgs e) { = ();} Xin chào bạn! | Chapter 1 Introduction to .NET and C File html head title My First Page title script runat server language C protected void Page_Load Object s EventArgs e script head body p Hello there p p The time is now asp Label runat server id lblTime p body html Both versions of the page achieve exactly the same thing. If you ve never done any server-side programming before this may be starting to look a little scary. Let s break down the new elements of this page File excerpt script runat server This tag otherwise known as a code declaration block marks the start of serverside code. Like the asp Label tag this script tag uses the runat server attribute to let know that the tag should be processed before sending the page to the browser. File excerpt Sub Page_Load s As Object e As EventArgs C File excerpt protected void Page_Load Object s EventArgs s I won t go into too much detail here. For now all you need to know is that you can write script fragments that are run in response to different events such as a button being clicked or an item being selected from a drop-down list. What the first line basically says is execute the following script whenever the page is loaded. Note that C groups code into blocks with curly braces while Visual Basic tends to use statements such as End Sub to mark the end of a particular sequence. So the curly brace in the C code above marks the start of the script that will be executed when the page loads for the first time. For the technically minded 26 This ll 700 pages Your First Page the code we ve just seen is a method definition for a page load event handler which is essentially the code that the server runs when the page is requested for the first time. Finally here s the line that actually displays the time on the page File excerpt .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.