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

remove duplicates in an sorted array

  using System; public class HelloWorld {          public static void Main(string[] args)     {         int[] ar={2,2,3,3,4,6,6};          C...