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

Professional in C# and Visual Basic Part 15. 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 End Function End Class C code-behind using System using using using using using using using using using public partial class RandomNumber private string _callbackResult null protected void Page_Load object sender EventArgs e string cbReference this arg GetRandomNumberFromServer context string cbScript function UseCallback arg context cbReference UseCallback cbScript true public void RaiseCallbackEvent string eventArg Random rnd new Random _callbackResult .ToString public string GetCallbackResult return _callbackResult When this page is built and run in the browser you get the results shown in Figure 2-16. Clicking the button on the page invokes the client callback capabilities of the page and the page then makes an asynchronous request to the code behind of the same page. After getting a response from this part of the page the client script takes the retrieved value and places it inside the text box all without doing a page refresh Now take a look at the .aspx page which simply contains an HTML button control and a TextBox server control. Notice that a standard HTML button control is used because a typical asp button control 93 Chapter 2 Server Controls and Client-Side Scripts does not work here. No worries. When you work with the HTML button control just be sure to include an onclick event to point to the JavaScript function that initiates this entire process input id Button1 type button value Get Random Number onclick GetNumber é Callback Page - Windows Internet Explorer j I http localhost49267 ServerControls 4 X Goooie p J ijj Page Tools

TỪ KHÓA LIÊN QUAN
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.