I have check-box input field on the view page as given below-
<input type=@item.InputType.ToString().Trim().ToLower() id="@item.AdminAnswers.ElementAt(i).Answer" value="@item.AdminAnswers.ElementAt(i).Answer" name="@item.Id"></input>@item.AdminAnswers.ElementAt(i).Answer
and in the controller am getting data using form collection as given below-
public ActionResult Index(FormCollection data)
{
foreach (var item in surveyDatas)
{
if(item.InputType.ToString().Trim().ToLower() == "checkbox")
{
var dev =item.NumberOfChoice;
for (int i = 1; i < dev; i++)
{
//here I need to iterate checked checkbox value
}
}
myclientanswer.DevAnswers = devAnswer;
clientAnswer.Add(myclientanswer);
}
return View("LoginResult");
}
How can I iterate only checked check-box values over there??