Я пытаюсь изменить значение моего viewDate (чтобы изменить HTML) бритвой, выберите onchange
Add.cshtml.cs
Severites = new SelectList(_context.Severite, "Id", "Subject");
ViewData["Color"] = _context.Severite.FirstOrDefault().SeveriteColor;
ViewData["Information"] = _context.Severite.FirstOrDefault().Subject; ;
ViewData["Message"] = _context.Severite.FirstOrDefault().Message;
return Page();
add.cshtml
<label asp-for="Ticket.SeveriteId" class="control-label">Severité</label>
<select asp-for="Ticket.SeveriteId" asp-items="Model.Severites" id="ddlSeve" class="form-control"></select>
<span asp-validation-for="Ticket.SeveriteId" class="text-danger"></span>
</div>
<div class="card text-white bg-@ViewData["Color"] mb-3">
<div class="card-header">@ViewData["Information"]</div>
<div class="card-body">
<p>
@ViewData["message"]
</p>
</div>
</div>