tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 14

Professional in C# and Visual Basic Part 14. 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 2 Server Controls and Client-Side Scripts By using the HtmlGenericControl class along with the other HTML classes you can manipulate every element of your pages from your server-side code. Manipulating Pages and Server Controls with JavaScript Developers generally like to include some of their own custom JavaScript functions in their pages. You have a couple of ways to do this. The first is to apply JavaScript directly to the controls on your pages. For example look at a simple Label server control shown in Listing 2-7 which displays the current date and time. Listing 2-7 Showing the current date and time VB Protected Sub Page_Load ByVal sender As Object ByVal e As End Sub C protected void Page_Load object sender EventArgs e This little bit of code displays the current date and time on the page of the end user. The problem is that the date and time displayed are correct for the Web server that generated the page. If someone sits in the Pacific time zone PST and the Web server is in the Eastern time zone EST the page won t be correct for that viewer. If you want the time to be correct for anyone visiting the site regardless of where they reside in the world you can employ JavaScript to work with the TextBox control as illustrated in Listing 2-8. Listing 2-8 Using JavaScript to show the current time for the end user @ Page Language VB html xmlns http 1999 xhtml head runat server title Using JavaScript title head body onload javascript 0 TextBox1 .value Date form id form1 runat server div asp TextBox ID TextBox1 Runat server Width 300 asp TextBox div form body html In this example even though you are using a standard TextBox server control from the Web server control family you can get at this control using JavaScript that is planted in the onload attribute of the body element. The value of the onload attribute .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
11    156    1    16-05-2024
44    105    0    16-05-2024
crossorigin="anonymous">
Đã 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.