
Professional VB 2005 - 2006 phần 7
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Professional VB 2005 - 2006 phần 7 Chapter 17 Cross-Page Posting The way in which Active Server Pages 2.0/3.0 (also called classic ASP) worked was that values fromimpo PDF Merge and posted Unregistered Version were usually steps in a process that the end user forms were usually Split to other pages. These pages - http://www.simpopdf.com worked through. With the introduction of ASP.NET on the other hand, pages in this environment posted back results to themselves in a step called a postback. One of the biggest requests of Web developers in the ASP.NET world has been the ability to do postbacks not only to the page from whence the values originated, but also the ability to do postbacks to other pages within the application. This new feature is something that has been provided with the release of ASP.NET 2.0. Cross-page posting (as it is referred) is an easy functionality to achieve now. It gives you the ability to post page values from one page (Page1.aspx) to an entirely different page (Page2.aspx). Normally, when posting to the same page (as with ASP.NET 1.0/1.1), you could capture the postback in a postback event as shown here: If Page.IsPostBack Then ‘ do work here End If Now, let’s take a look at Page1.aspx and see how you accomplish cross-page posting with ASP.NET 2.0. Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Label1.Text = “Your name is: “ & TextBox1.Text & “” & _ “Your appointment is on: “ & Calendar1.SelectedDate.ToLongDateString() End Sub Cross-Page Posting What is your name? When is your appointment? 628 ASP.NET 2.0 Advanced Features impo PDF Merge and Split Unregistered Version - http://www.simpopdf.com With Page1.aspx, you can see that there is nothing really different about this page — except for the Button2 server control. This page contains a new attribute which you will find with the Button, ImageButton, and LinkButton controls — the PostBackUrl attribute. The value of this attribute points to the location of the file that this page should post to. In this case, the PostBackUrl attribute states that this page should post to Page2.aspx. You can see that this is the only thing needed on the Page1.aspx to cause it to post back to another page. As for Button1, you can see that this is a simple button which will cause the page to post back to itself. This is nothing new as this has been the case even in ASP.NET 1.x. You can see the event handler for this postback in the OnClick attribute within the Button1 control. Pressing this button will cause the page to post back to itself and to populate the Label1 control that is at the bottom of the page. Clicking on the second button, though, will post to the second page, which is shown here: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim pp_TextBox1 As TextBox Dim pp_Calendar1 As Calendar pp_TextBox1 = CType(PreviousPage.FindControl(“TextBox1”), TextBox) pp_Calendar1 = CType(PreviousPage.FindControl(“Calendar1”), Calendar) Label1.Text = “Your name is: “ & pp_TextBox1.Text & “” & _ “Your appointment is on: “ & _ pp_Calendar1.SelectedDate.ToLongDateString() End Sub Second Page In this page, the first step is that in the Page_Load event, instances of both the TextBox and Calendar controls are created. From here, these instances are populated with the values of these controls on the previous page (Page1.aspx) by using the PreviousPage.FindControl() method. The S ...
Tìm kiếm theo từ khóa liên quan:
lập trình windows ứng dụng windows tìm hiểu windows lập trình ứng dụng lập trình phần mềm lập trình hệ thống lập trình dotNet lập trình Java lập trình PHPTài liệu có liên quan:
-
Mô tả công việc lập trình viên phần mềm
1 trang 230 0 0 -
Bài tập lập trình Windows dùng C# - Bài thực hành
13 trang 204 0 0 -
Bài giảng Công nghệ phần mềm - Chương 2: Quy trình xây dựng phần mềm
36 trang 185 0 0 -
Đề cương môn học Phân tích thiết kế phần mềm
143 trang 180 0 0 -
bảo mật mạng các phương thức giả mạo địa chỉ IP fake IP
13 trang 169 0 0 -
Luận văn : Xây dựng chương trình sắp xếp lịch trực bác sĩ
61 trang 162 0 0 -
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 159 0 0 -
Đồ án tốt nghiệp: Bảng LED ma trận điều khiển bằng ứng dụng Android
102 trang 148 0 0 -
Giáo trình Lập trình Android cơ bản: Phần 1
190 trang 139 0 0 -
[Thảo luận] Học PHP như thế nào khi bạn chưa biết gì về lập trình?
5 trang 137 0 0 -
Excel add in development in c and c phần 9
0 trang 124 0 0 -
information technology outsourcing transactions process strategies and contracts 2nd ed phần 3
65 trang 116 0 0 -
LUẬN VĂN: Tìm hiểu kỹ thuật tạo bóng cứng trong đồ họa 3D
41 trang 115 0 0 -
Program C Ansi Programming Embedded Systems in C and C++ phần 4
12 trang 103 0 0 -
Giáo trình Lập trình Windows 1 - Trường CĐN Đà Lạt
117 trang 103 0 0 -
Giáo trình môn kỹ thuật vi điều khiển
0 trang 100 0 0 -
Bài thu hoạch cá nhân môn Quản trị dự án phần mềm
75 trang 97 0 0 -
265 trang 92 0 0
-
81 trang 92 0 0
-
Bài giảng Lập trình trên Windows: Chương 1 - Trần Minh Thái
68 trang 90 0 0