i'm trying to show multiple error messages in view by toastr , for user register page.

I passed a list of error messages to View with TempData["errors"]

but i don't know how to show a list of string (for errors)

I did this for a successful message and the code is as follows

register.cshtml

@if (TempData["success"] != null)
    {
<script>
    $(document).ready(function() {

        var message = '@(TempData["success"])';

        toastr.options = {
            "rtl": true,
            "closeButton": false,
            "newestOnTop": false,
            "progressBar": false,
            "positionClass": "toast-top-left",
            "preventDuplicates": true,
            "onclick": null,
            "showDuration": "300",
            "hideDuration": "1000",
            "timeOut": "5000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        };

        toastr.success(message);


    });

Toastr supports messages with HTML tags in them. So you can put a <br/> tag for a line break.

Try this.

TempData["Errors"] = string.Join("<br/>", Errors);

Where Errors is a collection.

Here is the screenshot

Toastr displaying multiple messages