I have a class role as follows:
public enum Role
{
User1 = 1,
User2 = 2,
User3 = 3,
User4 = 4
}
I have the following codes in my model
public Role[] UserRoles { get; set; }
User user = User.Load(1);
UserRoles = user.Roles;
My question is this: I want to check the box for each role, and if Role == userRoles, the checkbox is true else false. How can I use @ HTml.CheckboxFor ... Can I get an example.
source
share