Ajax.NET and enums, XmlDocument,...

With the free Ajax.NET Library you can use enums, now. I will export the value as an string:

  enum MyType{ Unkown, Starting, Stopped, Killed }
 
MyType x = MyType.Starting;   // this will return "Starting" on the client-side

I also fixed the XmlDocument return value. You will have a XML DOM object on the client to parse this XML (this will be different in Internet Explorer and FireFox!!). If you want to get the XML as an string you can use .request.responseText instead of .value.

To use an HtmlControl as an argument has been fixed, also. There was a wrong client-side script that didn't send the complete control to the server. Cache support can be used together with changing the method name or specifiying the sessionstate support.

You can download the version 5.6.3.4 from my private web page http://ajax.schwarz-interactive.de/.

16 Comments

  • Robert McLaws said

    You might consider changing your versioning scheme so where your last digit is actually the build date. If you released a build today, it would be something like 5.6.4.50603, where 5=2005, 06=Month, 03=Day. Would make life easier understanding when the builds were put out.

  • Michael Third said

    You can ask me to leave whenever you feel like it, but I have another request :-)

    Our company has several zones that the client can request a WebMethod from. It would seem to make sense to allow the JavaScript consumer to specify a baseUrl ala:

    AjaxMethodHandler.baseUrl = "server1.my.net";
    AjaxMethodHandler.Go();

    AjaxMethodHandler.baseUrl = "server2.my.net";
    AjaxMethodHandler.Go();

    I've made a workaround by saving off "this.url" and changing it inside a loop, but its rather kludgy. You could even make this optional by having this.baseUrl = "".

  • Michael Third said

    Another request, what about implementing a simple method where one app server could call an Ajax method on another app server? I could code this up and submit it if you would like.

    Michael

  • AndrewSeven said

    I found it a little odd that I needed to specify .value on the return value of a function.

    alert(MyPage.ServerSideAdd(100,99).value)
    instead of
    alert(MyPage.ServerSideAdd(100,99))

    Is there a specific reason for this choice?

  • AndrewSeven said

    Yes but from the view of the script block where I call alert, the operation sure seems synchronous. I call it and I get the result object back.

    I gave AJAX a quick try today :) , I'll have a bit closer look on Monday

  • AndersH said

    On the client maybe it would be nicer to have the xml represented as a javascript associative array (maybe in the stryle that Perls XML::Simple create). That would make the code cross platform.

  • Passing Client Side String Arrays in to Ajax Funct said

    I cannot pass Client Side String Arrays in to an Ajax Function in a
    cs file. I am not sure what the problem is. I can pass an int Array into the Ajax function with no problems and I can pass pass the Client Side String Arrays as multiple string parameters into the server side function. Is this a Bug?

  • Ayehou M. said


    Trying to pass the following array on the client side Array("A,B","C") would end up as ["A","B","C"] on the serverside. Can anyone help me come to some kind of understanding. Is it supposed to be this way, or is this a bug?

    Further, why are double quotes (") escaped to \"?

  • AndersH said

    Ayeheo M.: I belive that it is the same problem, that you see. You don't write what results you get or what you expect to see, but I made this test, from your example (it all goes on one line):
    javascript:void(s="<img src=\"img\\en.gif\" onmouseover=\"Scream('aaa','bbb')\">");alert("Input:"+s+"\nExpected: <p>"+s+"</p>\nActual: "+DemoMethods.Test18([s]).value);

    It shows that the string in the singleton array is spilt on the comma, the first an last chars is removed (e.i. the double and sigle quotes from the first part of the string and the single and double quotes from the last part of the string) and the string is not decoded.

    I belive the problem would be removed by using the proposed FromJSArray function (but a move to using a url-encoding would be better, I think). In the mean time you might consider url-encoding the parameters (using the escape-function) on the clientside and decoding them on the server side or avoid using double quotes in the strings (ie. write <span id="j1"><img src='img/en.gif' onmouseover='Scream('aaa','bbb')'></span><br>) which might work.

  • AndersH said

    Hmm... encoding isn't quite working on this board either. The last example should read: <span id="j1"><img src='img/en.gif' onmouseover='Scream('aaa','bbb')'></span><br>

Comments have been disabled for this content.