Download C# Javascript Wrapper Sample

I have done a small sample on how to use the C# Javascript Wrapper in web applications to get new data without the need of a postback. Feel free to download the sample from http://schwarz-interactive.de/download/clientcallback.zip. Unzip the file, create a virtual IIS folder and start the application. The methods used in the default.aspx can be found in default.aspx.cs. They are marked with an attribute (MS.Web.JavascriptMethod). Currently you can use bool, int, string and XmlDocument for the return value, more later.

3 Comments

  • Charles Chen said

    Well, what is of interest in this case is that your client side Javascript can work directly on the string (a serialized version of your object) without translation/parsing on the client side using XML DOM. So you could write a JSONSerializer class and serialize object instances to strings which you could access using DOM on the client using eval() to create a Javascript object. Then you could directly work on the object on the client side and send the string back to the server.

    Just a thought :)

    You can do a lot of interesting htings with JSON and OOP.

Comments have been disabled for this content.