asp.net mvc 3 areas - Disable dropdown list in MVC3 -


"itemprop =" text ">

after I have dropdown: Controller:

  on db = new TransFormezEntities ( ViewBag.fldCountry_ID = new selectList (db.tblCountries, "fldCountry_ID", "fldCountryName", stateDetails.fldCountry_ID)  

see

country
  & lt; Div class = "display-field" id = "fldCountry_ID" & gt; @ Html.DropDownList ("fldCountry_ID", "[selection]") & lt; / Div & gt;  

How do I want to read or disable it?

Try the following pieces of code

For the disabled

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

To read only

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

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -