Below is my model class
public class InformationMissing : AbstractDBObject
{
public int Id { get; set; }
public string PatientDemographics { get; set; }
public string InsuranceDetails { get; set; }
public string PhysicianDetails { get; set; }
public string Note { get; set; }
public int personId {get;set;}
public string status { get; set; }
public List<CheckboxList_model> RetrievalItem { get; set; }
}
public class CheckboxList_model
{
public string Text { get; set; }
public int Value { get; set; }
public Boolean Selected { get; set; }
}
below is my controller method
public ActionResult Process()
{
List<CheckboxList_model> chkRetrieval = new List<CheckboxList_model>(){
new CheckboxList_model{ Text="One", Value = 1 ,Selected=false},
new CheckboxList_model{ Text="Two", Value = 2 ,Selected=false},
new CheckboxList_model{ Text="Three", Value = 3 ,Selected=false }
};
ViewBag.Retrieval = chkRetrieval;
return View();
}
Below code i have tried but checkboxlist is not filling
@foreach (var Retrieval in ViewBag.Retrieval)
{
@Html.CheckBoxFor(Retrieval.Selected, new { @class = "flat" })
@Html.DisplayFor(Retrieval.Text)
@Html.HiddenFor(Retrieval.Value)
}
From below foraech able to see text value but above checkboxlist is not filling
@foreach (var Retrieval in ViewBag.Retrieval)
{
<p>
@Retrieval.Text </p>
}