asp.net mvc - Making a drop down list readonly but still submitting its value -


I am using the Html.DropDownList helper in ASP.NET MVC and I want to read it only. Unfortunately, I also need that it could deposit its value on a form post.

I've found that only drop-down will be left by using (below) but this control value inside the controller.

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

Does anyone know how To create a drop down list is only read or disabled with ASP.NET MVC, while also allowing to submit with a form post?

wants to behave on behalf of the web browser - when a form is submitted, one is disabled The control will not post the data on the server.

You can duplicate this hidden field by putting it on the page with that value - just be sure to validate the data or use javascript to enable the field before submitting it.

If you are disabling a field, but still showing it with some value on the page, then you should know that the value is returned without a browser back to the server.


Comments