Mvc Flash Message as Partial View

I use FlashHelper to display flash messages to users, and I need to show a partial view of the istead standard flash message. How can I do this or is it possible or not?

I need an assistant:

Flash.Success("_FlashMessagePartial",model)

Or is there a library that you offer?

+4
source share
1 answer

. , - , . , , . , . , . : ,

if, , TempData​​p >

@if(TempData["error"])
{
   // here you can visualize it well styled by some template for example
   <div class="notification-error">@TempData[error]</div>
}
@if(TempData["success"])
{
   // here you can visualize it well styled by some template for example
   <div class="notification-error">@TempData[error]</div>
}

Then in your controller if you have something to say to the user you can
just do what you are doing like:

public ActionResult SomeAction(MyModel model)
{
    if(something is not valid)
    {
       this.TempData["error"] user error
       return this.View(model);
    }
}



That case was if you need some server validation and proper message to the     
user. After that option you have to set a script on your layout that removes
the error and success notifications if they exist on the page loads. 

, , js- , viewmodel, , .

: , JS toastr. URL-

, , .

0

All Articles