Make enum bindable to datagridview
I have an object which contains a number of string properties and an enum property called CRAction.
I have another object which represents a collection of the above object.
When I bind the collection object to something like a gridview, all of the string properties bind fine, but the enum doesn't appear.
I have added another string property w开发者_Go百科hich returns CRAction.ToString, but is there a better way to make an enum bindable to a control as part of an object?
It all seems a little hackish to have another property for the same thing purely for data binding!
This works for me:
<asp:Label> <%# DataBinder.Eval(Container.DataItem, "CRAction") %></asp:Label>
精彩评论