Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to Enable/Disable controls on a web page using MVC Razor view engine
Posted

you can use the disabled property in the MVC Control like below:


@Html.TextBoxFor(m => m.ModelPropertyName,new{disabled="disabled"})

If you want to make it readonly then use below code

@Html.TextBoxFor(m => m.ModelPropertyName, new { @readonly = "readonly" })
 
Share this answer
 
 
Share this answer
 
CodeProject[^]

First answer on google. Next time to that instead of asking blindly. Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900