Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
binding to enum
posted

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