0

I am adding form controls dynamically to my form. Below is a sample snippet how I am adding the Check Box control in my View. I also need to display a text box right below the Check box once it is Checked. Then the text should disappear once the check box is Un-Checked again. Can any one provide me some pointers on how to achieve this.

if (Model.Sections[i].Questions[j].Type.ToLower() == "singlecheckbox")
{
    <div class="large-8 columns">
    @Html.LabelFor(model => @Model.Sections[i].Questions[j].Name, Model.Sections[i].Questions[j].Name)
    @for (int k = 0; k < Model.Sections[i].Questions[j].Value.Options.Count; k++)
    {
        @Html.HiddenFor(model => Model.Sections[i].Questions[j].Value.Options[k].Id);
                @Html.HiddenFor(model => Model.Sections[i].Questions[j].Value.Options[k].Name);
                @Html.HiddenFor(model => Model.Sections[i].Questions[j].Value.Options[k].SecondaryValue);
                @Html.CheckBoxFor(model => Model.Sections[i].Questions[j].Value.Options[k].PrimaryValue)
    }
    </div>
    <br />
}
sethu
  • 229
  • 1
  • 3
  • 12

0 Answers0