TAILIEUCHUNG - aspnet sample_part9

Navigation Đối tượng và phương pháp của họ Bây giờ bạn đã thông qua các sản phẩm trang , bạn phải lấy nó từ chuỗi truy vấn trong trang mới. Chúng tôi có được giữ của các biến từ chuỗi truy vấn bằng cách truy cập vào bộ sưu tập , như vậy: | Navigation Objects And Their Methods Now that you ve passed the product to the page you have to grab it from the query string in the new page. We get hold of variables from the query string by accessing the collection like so Sub Page_Load Product End Sub C void Page_Load Product Here we simply display the value of the Product query string parameter as we see in Figure . Figure . Set the text property of the label control within a Page_Load event handler to accept the new parameter value. Now when you select a product and add it to the cart the result is displayed in the redirected page on a label with an id of lblResult. Now sure a real product Order the prin T er is -hiis trial version 111 Chapter 4 Web Forms and Web Controls catalog and shopping cart has a lot more to it but in this section we ve uncovered an important building block. Postback Postback can be confusing to newcomers because while most developers know what it is they can t seem to explain it clearly. The topics we ve covered so far like subroutines functions and events are not new to most Web developers. HTML in combination with client-side JavaScript has been doing all that for years. is different to this model though because it is a serverside not client-side technology events that occur on a page are handled by code running on the server. For this to work uses the mechanism of postback. When an event is triggered for instance a button is clicked or an item in a grid is selected the page is submitted back to the server for processing along with information about the event and any preexisting data on the page via view state . We say the page posts back to the server. This is a powerful concept to grasp because it is postback that lets us run code on the server rather than on the client s browser and it is postback that lets our server code .

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.