0

I have a texbox and 3 radio buttons associated with that textbox. Below is the code.

 for (int advancedSkills = 0; advancedSkills <= 0; advancedSkills++)
        {
            <div class="row" id="experienceTexts">
                <div class="col-md-3">

                    @Html.TextBoxFor(model => Model.ClinicalQ2textAnswers[advancedSkills].clinicalExpDetails, new { @onclick = "onClinicalTextChanged(this)" })
                    @Html.HiddenFor(m => Model.ClinicalQ2textAnswers[advancedSkills].AnswerID)
                    @Html.HiddenFor(m => Model.ClinicalQ2textAnswers[advancedSkills].AnswerDescription)

                </div>
                @for (int i = 0; i < Model.ClinicalQ2ExpAnswers.Count(); i++)
                {
                <div class="col-md-3">

                    @Html.RadioButtonFor(m => Model.ClinicalQ2SelectedExpAnswers[advancedSkills], Model.ClinicalQ2ExpAnswers[i].AnswerID)
                    @Html.HiddenFor(m => Model.ClinicalQ2ExpAnswers[i].AnswerID)
                    @Html.HiddenFor(m => Model.ClinicalQ2ExpAnswers[i].AnswerDescription)

                </div>
                }
            </div>
            <br />
        }

Now I want a link or button (which is easier) like: + click to add more skills . This should add another textbox and its related radiobuttons.

How can I do that? And it should bind it to model also each time I click the + symbol. So If I press that 4 times, 4 textboxes and its radiobutton values should bind to model.

Agnes
  • 57
  • 1
  • 7
  • 1
    Can you also specify the language you are using? Is it ASP.NET MVC and Razor? – Praveen Kumar Purushothaman Apr 10 '18 at 20:14
  • @PraveenKumar : Yes, ASP.net MVC and Razor with HTML Helpers – Agnes Apr 10 '18 at 20:25
  • OKay, I have already updated the tags. – Praveen Kumar Purushothaman Apr 10 '18 at 20:26
  • Refer [this answer](http://stackoverflow.com/questions/28019793/submit-same-partial-view-called-multiple-times-data-to-controller/28081308#28081308) for some options, and [this one](http://stackoverflow.com/questions/40539321/partial-view-passing-a-collection-using-the-html-begincollectionitem-helper/40541892#40541892) for a detailed example using `BeginCollectionItem –  Apr 10 '18 at 20:45

0 Answers0