How to provide “success” feedback to a user in ASP.NET MVC?

Suppose we have an Edit View for editing our data, and we want to tell the user the result of their editing, i.e. to confirm that it is indeed successfully saved in the Model.

One solution is to assign the ViewData message in the Edit Controller action method, and then use the view to display the message back to the user.

eg. In the "Edit controller" action method:

ViewData["EditResult"] = "All is well in the world.";

... and somewhere in the view:

<%= ViewData["EditResult"] %>

It's nice and easy, but the best way to provide feedback to the controller in the view? What are some other alternatives, as I seem to be bordering on you adding view type material to the controller.

+5
2

, ; .

, .

+1

Show, . Show . , , . , : , , .

0

All Articles