TAILIEUCHUNG - Beginning asp net 2.0 with c phần 6

Trong phần sau đây thử, bạn cung cấp cho người dùng một cách để thêm hình ảnh vào thư viện. Thử tập tin tải lên - cơ bản 1. Sử dụng VWD, tạo ra một trang mới được đặt tên bằng cách sử dụng mẫu Web Form. | Componentization You ll see how you can manipulate all of these controls in the same way as you might expect to when using a single file. Try It Out Creating a Code-Behind File 1. Open VWD and create a new web site called TestCodeBehind in the Chapter directory C BegASPNET2 Chapters Begin Chapter10 . 2. Go to Solution Explorer and click the plus symbol next to to expand the tree to reveal the file refer to Figure 10-1 . Again is the only file that has the code-behind file automatically created for you. If you create another Web Form you must make sure to check the Place Code in a Separate File option which is unchecked by default. 3. Go back to the file and add two Label controls a TextBox control and a Button control as shown in Figure 10-2. Figure 10-2 353 Chapter 10 Adjust the source HTML to read as follows asp Label ID Label1 runat server Text What is the answer to the meaning of life the universe and everything asp Label br br asp TextBox ID TextBox1 runat server asp TextBox br br asp Button ID Button1 runat server Text Submit br br asp Label ID Label2 runat server Text asp Label 4. Go back to Design View and double-click anywhere on the background of other than on the controls. Doing so will open up into the code-behind file shown in Figure 10-3. Figure 10-3 5. Add the following code to the Page_Load event handler if if 42 So you read Douglas Adams as well. else 354 Componentization No I m not sure that s it 6. Click the green arrow to run it. You may get a textbox asking whether or not to add a new file or run without debugging. Click the former. 7. Enter a value or lengthier sentence into the text box as shown in Figure 10-4. Figure 10-4 How It Works It all seems very simple instead of putting your code within script tags you place it within a separate page connected by the Page directive tag. Indeed if you check at the top of

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.