Dztm

Dztm

  • 1.3k
  • 402
  • 340

How To Build Dropdown

Sep 23 2024 7:59 AM

@if (Model.Competencies != null && Model.Competencies.Any())
                        {
                            for (int i = 0; i < Model.Competencies.Count(); i++)
                            {
                                <tr class="competencyRow">
                                    <td width="25%">
                                        @Html.DropDownListFor(model => Model.Competencies[i].Compentency_Group, new SelectList(HRCompentencyTools.Models.ModelCompentencyAssessment.GetCompetencyGroups(), "Value", "Text", Model.Competencies[i].Compentency_Group),
                                       new { @class = "form-control competency-edit "})
                                    </td>
                                    <td width="700px">
                                        @Html.DropDownListFor(model => Model.Competencies[i].Competency, new SelectList(HRCompentencyTools.Models.ModelCompentencyAssessment.GetBankCompetencies(), "Value", "Text", Model.Competencies[i].Competency),
                                       new { @class = "select js-example-basic-single form-control competency-edit"})

                                    </td>
                                    <td>
                                        @Html.DropDownListFor(model => model.Competencies[i].Required_Score, new SelectList(Enumerable.Range(1, 5).Select(x => new SelectListItem { Value = x.ToString(), Text = x.ToString(), }), "Value", "Text"), Model.Competencies[i].Required_Score,
                                       new { @class = "form-control competency-edit",})
                                    </td>
                                    <td><input type="button" value="Remove" onclick="Remove(this)" /></td>
                                </tr>
                            }
                        }

How do I make it so that when I click the radio button yes he is disabled, but when I click no the data row is deleted all and there is an add button to add a new data row and dropdownlist according to the model and submit button


Answers (3)