
I want to create a form as shown above,
You also need to populate Viewer accodrding user groups in the UserGroups table 
public partial class UserGroup { public string UserGroup_ID { get; set; } public string UserGroupNameEn { get; set; } }
Fill in these user groups and get the completed data that I created a new model (so that it can be applied to viewing (1st image))
I followed the abstracts of question 1 and question 2 to do this
this is the controller class for this
[HttpGet] public ActionResult ProductFields_Create() { var model = new ProductFields { LisGroups = GetUserGroupListEn() }; return View(model); } public MultiSelectList GetUserGroupListEn() { return new MultiSelectList(db.UserGroup.ToList(), "UserGroup_ID", "UserGroupNameEn"); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult ProductFields_Create(ProductFields product_fields) { ........... }
this is the model class for the first image
public class ProductFields { public string ProductFieldID { get; set; } public string ProductFieldNameEn { get; set; } public string ProductFieldNameAr { get; set; } public string ProdcutFieldDiscriptionEn { get; set; } public string ProductFieldDiscriptionAr { get; set; } public List<UserGroup> LisGroups { get; set; } [Required] public string SelectedGroupID { get; set; } }
page view to view above
@model Project_Name.Models.ProductFields @using (Html.BeginForm()) { <fieldset> <div class="form-horizontal"> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) ..... <div class="form-group"> <div> @Html.ValidationMessageFor(x => x.SelectedGroupID) foreach (var group in Model.LisGroups) { <div> @Html.RadioButtonFor(x => x.SelectedGroupID, group.UserGroup_ID, new { id = "emp" + group.UserGroup_ID }) @Html.Label("emp" + group.UserGroup_ID, employee.Label) </div> } </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Create" class="btn btn-default" /> </div> </div> </div> </fieldset> }
but here i get serious errors with red squiggly lines
The name "group" does not exist in the current context

It is not possible to implicitly convert the type 'System.Web.Mvc.MultiSelectList' to 'System.Collections.Generic.List'
