Splitting CamelCase

Aloush

New Member
This is all asp.net c#.I have an enum\[code\]public enum ControlSelectionType { NotApplicable = 1, SingleSelectRadioButtons = 2, SingleSelectDropDownList = 3, MultiSelectCheckBox = 4, MultiSelectListBox = 5}\[/code\]The numerical value of this is stored in my database. I display this value in a datagrid.\[code\]<asp:boundcolumn datafield="ControlSelectionTypeId" headertext="Control Type"></asp:boundcolumn>\[/code\]The ID means nothing to a user so I have changed the boundcolumn to a template column with the following.\[code\]<asp:TemplateColumn> <ItemTemplate> <%# Enum.Parse(typeof(ControlSelectionType), DataBinder.Eval(Container.DataItem, "ControlSelectionTypeId").ToString()).ToString()%> </ItemTemplate></asp:TemplateColumn>\[/code\]This is a lot better... However, it would be great if there was a simple function I can put around the Enum to split it by Camel case so that the words wrap nicely in the datagrid.Note: I am fully aware that there are better ways of doing all this. This screen is purely used internally and I just want a quick hack in place to display it a little better.
 
Back
Top