Đang chuẩn bị liên kết để tải về tài liệu:
Beginning Ajax with ASP.NET- P14

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Beginning Ajax with ASP.NET- P14:Thank you for purchasing Beginning Ajax with ASP.NET. We know that you have a lot of options when selecting a programming book and are glad that you have chosen ours. We’re sure you will be pleased with the relevant content and high quality you have come to expect from the Wrox Press line of books. | Ajax.NET Professional Library Notice the number of parameters that you re passing into the ImageSwitcher.ChangeImage method. There are now five parameters where before there were only three. The server-side method accepts only three so how can this work Remember that this is actually a JavaScript proxy object that is created by the Ajax.NET Pro library for you to use. Every proxy object that is created is created with a couple of overloads. An overload is a variation of a method using the same method name but with a unique set of parameters known as a signature. The signature is defined as the order and types of the parameters the method accepts. The proxy object Chapter7_ImageSwitcher.ChangeMe gets created with the following signatures. Chapter7_ImageSwitcher.ChangeImage string string string Chapter7_ImageSwitcher.ChangeImage string string string callback Chapter7_ImageSwitcher.ChangeImage string string string callback context Notice the last two parameters callback and context. callback is the name of the method that you want the response to be sent to. In this example you would have a problem if all you could work with in the callback method was the response from the server. You d have a problem because you need to set the value of the image tag and you wouldn t know what that image tag was. So Ajax.NET Pro has a last parameter called context. Whatever object you pass in as the context parameter will be returned in the response object as its context property. Remember the response object has five properties value error request extend and context. Now you see where the context is helpful. The context basically gets a free ride from your execution point where you ask for the server method to be called into your callback method. It is common to name the callback function the same as the original function name with the _Callback appended to it. Take a look at this callback function. function ChangeMe_Callback response if response.error null alert response.error.name