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

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...