tailieunhanh - Beginning Ajax with ASP.NET- P20

Beginning Ajax with P20:Thank you for purchasing Beginning Ajax with . 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. | Atlas Client Script function ComplexScriptCompleteCallback result alert Value result script input type button value Click for Complex DataType onclick ComplexDataTypeCall atlas ScriptManager ID Script1 runat server Services atlas ServiceReference Path Services atlas ScriptManager div div form script type text xml-script page xmlns script http xml-script 2005 references references components components page script body html The code for the complex data type is public class cComplexCustomerType public cComplexCustomerType private string _Name private string _Address public string Name get return _Name set _Name value public string Address get return _Address set _Address value The code for the web service is WebMethod public cComplexCustomerType AcceptComplexDataType cComplexCustomerType objComplexCustomerType 261 Chapter 10 return objComplexCustomerType In this example code the web service accepts the custom business object and then returns the value. There is nothing that would stop the web service from using the properties of the business object that is passed or the web service from returning a string as opposed to the custom business object. Interrogation of the custom object returns interesting information. The following code will generate the results in Figure 10-5. This figure shows that the Name and Address properties are available along with an added member theserverType property. This property defines the type on the server. function ComplexScriptCompleteCallback result var str result for prop in result str Member prop r n alert str Figure 10-5 A call to on the returned result object produces the output in Figure 10-6. The debug .dump method displays the contents of an object in Atlas. This method will be discussed more later in this chapter. Figure 10-6 262 Atlas Client Script Caching Web Services The data returned from a web service may be cached. This can be helpful in situations

TỪ KHÓA LIÊN QUAN