I have a edit form which should have checkbox.
My Model for the page is
public class MyModel{
public string Name {get;set;}
public List<AdType> AdTypeList { get; set; }
}
Enum AdType{
[Display(Name = "None")]
None,
[Display(Name = "Additional")]
Additional_Photo,
}
So i have to check the check box with respect to the data coming from the database. And also update should happen if i make changes and submit. To work that way what changes i need to make in my html helper for the checkbox?
foreach (AdType role in Enum.GetValues(typeof(AdType)))
{
<label>
<input name="Roles" type="checkbox" value="@role" checked="@(Model != null)" />
@{var x = EHelper.GetDisplayValue<AdType>(role);}
@x
</label>
}
I am new to mvc, please parden if i m doing something stupid.