Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

After a redirect

Keep a message across a redirect with TempData.Flash, and the layout shows it once on the next page.

The four looks
Success is the default; use warning for a step that worked with a caveat and danger for one that failed.
Show code
public IActionResult OnPost()
{
    // …save the ticket…
    TempData.Flash("Ticket saved.");
    return RedirectToPage("./Index");
}

<app-flash />

Error summary

A failed post returns its errors, and one tag lists them all without a loop.

Two errors
Show code
<app-error-summary from-model-state="true" title="Fix 2 things before you save" />

Every option

Every value of every prop, one cell each.

TempData.Flash(message)

message: the words the toast shows, such as "Ticket saved."

variant

variant: Success (default)
variant: Info
variant: Warning
variant: Danger

<app-flash />

<app-flash />: takes no attributes; shows the kept message once

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

3 props.

Less common 3 props

PropTypeDefaultDescription
TempData.Flash(message)default - string - Keeps the words the toast shows for the next page. An empty message throws.
variantdefault Success FlashVariant Success The toast's look: Success, Info, Warning or Danger. The second argument of TempData.Flash.
<app-flash />default - - - Goes once in the layout. It takes no attributes and shows the kept message once.