Sunday, 12 September 2021

mvc chagne default dropdown value

  <div class="col-sm-12">

                        @Html.DropDownListFor(x => x.productMaster.PaymentOption, new SelectList((List<Config.Contract.Lookup>)ViewData["PaymentType"],

                                                                                   "LookupID", "LookupDescription"), "THB", new { @class = "form-control input-sm" })

                    </div>

1.here instead of seleted type i have given value code thb

2.incase you have id instead of value give like this

 <div class="col-sm-6">

                        @Html.DropDownListFor(x => x.productMaster.AgeType, new SelectList((List<Config.Contract.Lookup>)ViewData["AgeType"],

                                                                                    "LookupID", "LookupDescription", 2130), AppResource.Age, new { @class = "form-control input-sm" })

       </div>

No comments:

Post a Comment

API run block issue run api from cmd

  ✅ Debug Checklist – “Access is Denied” (.NET / Visual Studio) 🔹 Identify Problem ☐ Error: Unable to start program (.exe) – Access is deni...