开发者

show enum in view

i have enum

开发者_Python百科
 public enum TypeImage
{
    Img=0,
    Thumb=1
}

i want in view show <%= TypeImage.Img %> -it shows "img" but not 0. what the problem?


maybe something like:

<%= Convert.ToInt32(TypeImage.Img) %>


To show 0 you need to cast enum to integer:

<%= (int)TypeImage.Img %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜