It is actually very simple, the disable attribute is already working as you want – you can pass in a boolean value:
<textarea asp-for="Doc" disabled="@Model.MustDisable"></textarea>
if false the
disabled attribute is not rendered:
if true the
disabled attribute is set to “disabled”:
- Select Tag Helper in ASP.NET Core MVC
- ASP.NET MVC 4 – for loop posts model collection properties but foreach does not
- How to use ternary operator in razor (specifically on HTML attributes)?
- Pass parameter to controller from @Html.ActionLink MVC 4
- Render Razor View to string in ASP.NET Core
- Can we use Razor syntax in ASP.NET Webforms (*.aspx pages)?
- IntelliSense in Razor files (.cshtml) stopped working
- Post an HTML Table to ADO.NET DataTable
- Pass List of Checkboxes into View and Pull out IEnumerable [duplicate]
- Injecting content into specific sections from a partial view ASP.NET MVC 3 with Razor View Engine
- ASP.NET MVC View Engine Comparison
- ASP.Net MVC: How to display a byte array image from model
- How do I write unencoded Json to my View using Razor?
- Use multiple JWT Bearer Authentication
- Getting value from appsettings.json in .net core
- How to use jquery or ajax to update razor partial view in c#/asp.net for a MVC project
- MVC3 Razor DropDownListFor Enums
- What is the equivalent of Server.MapPath in ASP.NET Core?
- White space at top of page
- How to get a list of all routes in ASP.NET Core?
- Razor-based view doesn’t see referenced assemblies
- Visual Studio 2015 not syntax highlighting razor nor Intellisense
- Razor views as email templates
- How can I trigger/refresh my main .RAZOR page from all of its sub-components within that main .RAZOR page when an API call is complete?
- Razor Views not seeing System.Web.Mvc.HtmlHelper
- EditorTemplate for DropDownList
- MVC 6 Bind Attribute disappears?
- ASP.NET MVC 3 Razor – Adding class to EditorFor
- How can I pass parameters to a partial view in mvc 4
- MVC Razor @foreach
- How to use a controller in another assembly in ASP.NET Core MVC 2.0?
- I want to understand the lambda expression in @Html.DisplayFor(modelItem => item.FirstName)
- Continued Ninject support in ASP.NET Core MVC?
- jQuery: How to traverse / Iterate over a list of object
- ASP.NET Core Get Json Array using IConfiguration
- Html helper for
- Unexpected “foreach” keyword after “@” character
- The name ‘model’ does not exist in current context in MVC3
- Generic repository in ASP.NET Core without having a separate AddScoped line per table in Startup.cs?
- How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?
- Complex models and partial views – model binding issue in ASP.NET MVC 3
- ASP.Net MVC 4 Form with 2 submit buttons/actions
- How can I call a SQL Stored Procedure using EntityFramework 7 and Asp.Net 5
- How to get the Development/Staging/production Hosting Environment in ConfigureServices
- Where is Request.IsAjaxRequest() in Asp.Net Core MVC?
- Why doesn’t Visual Studio code formatting work properly for Razor markup?
- Getting controller name from razor
- Html.Raw() in ASP.NET MVC Razor view