This shows "Hello there" inside the textarea:
@model PlannerViewModel
@{
ViewData["Title"] = "Test";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Test</h2>
<form method="post">
<div class="border rounded">
<textarea class="form-control MyTextArea" rows="4">Hello there</textarea>
</div>
</form>
This doesn't show "Hello there" inside the text area:
@model PlannerViewModel
@{
ViewData["Title"] = "Test";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Test</h2>
<form method="post">
<div class="border rounded">
<textarea class="form-control MyTextArea" rows="4" asp-for="EditShutdown.Comments_Operations">Hello there</textarea>
</div>
</form>
As you see, the only difference is the presence of "asp-for". Am I doing something wrong? Is there any workaround?
To solve this annoying event, you can use ;
@Html.IdFor
and
@Html.NameFor
Example;
<textarea id="@Html.IdFor(m => m.EditShutdown.Comments_Operations)" name="@Html.NameFor(m => m.EditShutdown.Comments_Operations)">Hello there</textarea>
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