How to check a radio button based upon the enum value

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-04-19T06:33:40Z Indexed on 2010/04/19 6:43 UTC
Read the original article Hit count: 278

Filed under:

I have an enum. Based upon the value brought by model, I have to check radio button. How can I do that?

<%=Html.RadioButton("Role", Role.Viewer)%><%= .Role.Viewer%>
        <%=Html.RadioButton("Role",.Role.Reporter)%><%= Role.Reporter%>
        <%=Html.RadioButton("Role",Role.User)%><%= Role.User%>

My enum would be having the numbers 1 to 3 for e.g. How can I check the Role.Viewer if enum value selected is 1?

© Stack Overflow or respective owner

Related posts about asp.net-mvc