tags:

views:

1133

answers:

2

Hi,

What option do I need to set to make a drop down box readonly when using MVCs Html.DropDownList?

I've tried things like....

Html.DropDownList("Types", Model.Types, new { _Enabled = "false" })

...and many different things along this line; alas no joy!

I thought this would be an easy.....and it probably is!!!!!

Thanks,

ETFairfax.

+3  A: 

Try this


    Html.DropDownList("Types", Model.Types, new { @disabled = "disabled" })

Tadas
That's the puppy. Thanks.
ETFairfax
+1  A: 

Hi thanks for your tip : Html.DropDownList("Types", Model.Types, new { @disabled = "disabled" }) I tried it and found that if you use this attributs you won't be able to retreive values after postback in the FormCollection object. Do you have another method to get those values back ?

THomas
I had this issue too so I asked it as a separate question here: http://stackoverflow.com/questions/2858511/
YeahStu