0

I have filled up dropdown as: Controller:

var db = new TransFormezEntities()           
ViewBag.fldCountry_ID = new SelectList(db.tblCountries, "fldCountry_ID", 
                                    "fldCountryName", stateDetails.fldCountry_ID)

View

Country
<div class="display-field" id = "fldCountry_ID">
      @Html.DropDownList("fldCountry_ID", "[Select]")
</div>

I want to make it readonly or disable how can i please ?

Cris
  • 12,799
  • 5
  • 35
  • 50

1 Answers1

0

try following code snippets

For disabled

  Html.DropDownList("fldCountry_ID", ViewBag.fldCountry_ID ,
                                       new { @disabled = "disabled" })

For readonly

Html.DropDownList("fldCountry_ID", ViewBag.fldCountry_ID , 
                                  new { @readonly = "true" })
Cris
  • 12,799
  • 5
  • 35
  • 50