What is the proper way to bind to enum model property? Using the GridModel.GetData() to generate the JSON response in an MVC3 setup, I get just the numeric value of the enum property in the JSON.
Is there a hook where one can easily transform what gets serialized? I can't do it in a .Select(x => new { StringEnumAsString = x.SomeEnum.ToString() ...}) because that will generate a failed to convert linq query exception. You have to provide an IQueryable to .DataSource for paging to work. So how does one transform the rows once the correct rows have been selected after paging and sorting?
Is the only way to transform on the client side with javascript?
Thanks
Hello wpbrown,
Thank you for posting in our forums.
I am not sure that I completely understood your question.
Is it related to the fact that Enum property is serialized to an integer rather than a string containing its name?
If this is the case, please refer to the blog post below:
http://buildingwebapps.blogspot.com/2011/11/serializing-c-enum-to-json-by-its-name.html
If another is the case, please clarify.
Hope hearing from you.
Thanks. This works. It would be nice if the grid natively support enums.