As enums are not working very good using my Ajax.NET library I have added a new implementation of handling enums. Each enum value will be returned as the integer value inside the enum.
public enum Color { Black, Yellow, Green }
To use the same syntax on the client-side JavaScript you can export enums to use on the page:
RegisterNamespaces("ConsoleApplication11.Color"); ConsoleApplication11.Color = function() { this.Black = 0; this.Yellow = 1; this.Green = 2; }
A sample JSON string will be rendered as:
var person = {"__type":"ConsoleApplication11.Person","MyColor":0,"FamilyName":"Schwarz","Firs tName":"Michael"};
On the client-side JavaScript you can use following syntax to check the MyColor property, now:
<script language="javascript">
var person = Page.GetPersonFromID(3); if(person.MyColor == ConsoleApplication11.Color.Yellow) alert("Yellow");
</script>