Custom class:
Public ClassPeople {Private StringName;Public StringName {Get{ReturnName ;}Set{Name =Value;}}Private StringPassword;Public StringPassword {Get{ReturnPassword ;}Set{Password =Value;}}}
WebService:
[Webmethod]PublicPeople [,] get2array () {People [,] P =NewPeople [3, 4];For(IntI = 0; I <3; I ++ ){For(IntJ = 0; j <4; j ++) {P [I, j] =NewPeople (); P [I, j]. Name = I. tostring () +"-"+ J. tostring (); P [I, j]. Password ="PWD"+ I. tostring () + J. tostring ();}}ReturnP ;}
Scriptmanager:
<Asp: scriptmanager id ="Sm"Runat ="Server"> <Services> <asp: servicereference Path ="~ /Webservice2.asmx"Inlinescript ="True"/> </Services> </ASP: scriptmanager>
Page Control:
<Input type ="Button"Value="Click me!"Onclick ="Btn_click ()"Id ="BTN"/> <Div id ="Result"> </Div>
JS:
<SCRIPT type ="Text/JavaScript"> Function btn_click () {webservice2.get2array (onsuccessed);} function onsuccessed (result) {debugger;For(VAR I = 0; I <result. length; I ++) {var label = Document. createelement ("Label"); Label. innerhtml = Result [I]. Name +"-----"+ Result [I] ["Password"] +"<Br/>"; $Get("Result"). Appendchild (Label) ;}</SCRIPT>
Result:
Debugger: