I would like to conditionally disable this button, or make it read only so the user can just see the data displaying in the box or text but not being able to edit whatsoever, i have tried many steps towards this issue but nothing seems to be working if you look in my code below.
can anyone advice me or come up with a solution for this matter. thank you in advance.
<div class="inline-block-side">
@if (Model.Promotion.PromotionID == 209)
{
@Html.DisplayFor(model => model.Promotion.PromotionTitle)
}
else
{
<div class="editor-label">
@Html.LabelFor(model => model.Promotion.PromotionTitle)
</div>
<div class="editor-field" title="The name of the Promotion" @((Model.Promotion.PromotionID == 209) ? "disabled" : "")>
@Html.EditorFor(model => model.Promotion.PromotionTitle)
@Html.ValidationMessageFor(model => model.Promotion.PromotionTitle)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Promotion.ArtworkDate)
</div>
<div class="editor-field" title="The date the Artwork is to be recieved by">
@Html.TextBoxFor(model => model.Promotion.ArtworkDate, "{0:dd/MMM/yyyy}", new { @id = "ArtworkDate", @class = "date" })
@Html.ValidationMessageFor(model => model.Promotion.ArtworkDate)
</div>
You can use @Html.DisplayFor to solve your problems, or you can user jquery enable, disable attributes to make textboxe readOnly