tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 30
Professional in C# and Visual Basic Part 30. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 5 Working with Master Pages runat server b Your GUID number from the master page is br asp Label ID Label1 runat server b p b Enter your name b br asp Textbox ID TextBox1 runat server br br asp Button ID Button1 runat server Text Submit OnClick Button1_Click br br asp Label ID Label2 runat server Font-Bold True asp Content asp Content ID Content3 ContentPlaceHolderId ContentPlaceHolder2 runat server asp Image ID Image1 runat server ImageUrl asp Content C @ Page Language C MasterPageFile script runat server protected void Page_LoadComplete object sender EventArgs e Label1 as Label .Text protected void Button1_Click object sender EventArgs e b Hello b script In this example the master page in Listing 5-8 first creates a GUID that it stores as a text value in a Label server control on the master page itself. The id of this Label control is Label1. The master page generates this GUID only on the first request for this particular content page. From here you then populate one of the content page s controls with this value. The interesting thing about the content page is that you put code in the Page_LoadComplete event handler so that you can get at the GUID value that is on the master page. This new event in fires immediately after the Page_Load event fires. Event ordering is covered later but the Page_Load event in the content page always fires before the Page_Load event in the master page. In order to get at the newly created GUID if it is created in the master page s Page_Load event you have to get the GUID in an event that comes after the Page_Load event and that is where the Page_LoadComplete comes into play. Therefore within the content page s Page_LoadComplete event you populate a Label server control within the content page itself. Note that the Label control in the content page has the same id as the Label control in the master page but this doesn t make a difference. .
đang nạp các trang xem trước