Reputation: 438
I am trying to Invoke Components from inside the view, but keep getting errors. And online I can only find examples working with ASP.NET Core, but I am not using Core.
This is my View:
@model BeestjeOpJeFeestje.Models.BoekingProces
<h2>Boeken</h2>
<hr />
<div class="row">
<div class="col col-9" style="padding: 0">
@switch (Model.Boeking.BoekingStatus)
{
case BeestjeOpJeFeestje.Models.BoekingStatus.Beestjes:
if (TempData["error"] != null)
{
<span class="text-danger">@TempData["error"]</span>
}
@await Component.InvokeAsync("BeestjesKiezen", @Model);
break;
case BeestjeOpJeFeestje.Models.BoekingStatus.Accessoires:
@await Component.InvokeAsync("AccessoiresKiezen", @Model);
break;
case BeestjeOpJeFeestje.Models.BoekingStatus.Informatie:
@await Component.InvokeAsync("Klantgegevens", @Model);
break;
case BeestjeOpJeFeestje.Models.BoekingStatus.Bevestiging:
@await Component.InvokeAsync("Bevestiging", @Model);
break;
}
</div>
<div class="col col-3">
@await Component.InvokeAsync("BookingDetail", @Model)
</div>
</div>
But it results in the errors that 'await' and 'Component' not exists in the current context.
Can someone maybe help me with the correct syntax? Thanks in advance.
Upvotes: 1
Views: 287
Reputation: 6185
@{
Html.RenderPartial("BeestjesKiezen", Model);
}
Upvotes: 1