Click here to Skip to main content
14,693,599 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Enum.
Enum abs
{
  yy=1,
yy/yy=2
}

This way i want to define and want to display in radiobutton list this way when i bind my list to this Enum.

But at the time of writing Enum,its giving me error when i use / . Please suggest.
Posted
Updated 7-Nov-13 19:43pm
v2

You can use DisplayName attribute with the enum.

Below - not a realistic example but something that you could consider.
public enum Name{
  [DisplayName("FN")] FirstName,
  [DisplayName("%LN")] LastName
}
   
v2
Comments
Torakami 8-Nov-13 1:26am
   
this seemsz to me good but where shall i put values . because i also want to assign value as well .. say for yy format 0 and for yy/yy format 1 .. as i am binding this enum with radiobutton list
You are using forbidden character for variable/constant/enum items. No way you can use that character. You can use "_" instead.

Your item cannot begin with a number, nor use % & / + - * anywhere.

Google "reserved characters" for more info.

Also, I'm not sure you are supposed to giva a value to your enumeration items, they usually number themselves starting at 0.
   
Comments
Torakami 8-Nov-13 1:13am
   
what i want to do is .. in my radio button list i want to diplay yy and yy/yy . or i am choosing Enum because there may be chances that user can select some other formats as well .. so .. any way i can achive this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900