The below doesn't seem to work unless @ is before the @Html. Why is that?
@{
if (DescriptionIsFieldReadOnly) {
Html.TextArea("description-edit", Model.Requisition.ReqHdr.Description, new { @Readonly = "readonly" });
}
else {
Html.TextArea("description-edit", Model.Requisition.ReqHdr.Description);
}
}
Html.TextArea(...) returns an IHtmlString with the HTML code you want.
If you call it as a normal function, you don't actually do anything with that return value, so nothing happens.
Using @ turns it into a Razor expression that prints its value to the page.
Incidentally, that isn't a statement, so it should not have a semicolon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With