0

I want to show a Review page after the user fill sout all the information but on the review page I need to have a "Back" button which should take the user back tot he previous page with the same state and all the changes that they have made. What is the best way of achieving this ? I coded the review page on a different view but then the back is clicked the state of the page with all the changes I lost.

I have tried trying to code the view in another view page

tereško
  • 58,060
  • 25
  • 98
  • 150
Ruk
  • 3
  • 1

1 Answers1

0

The best way is that you support the parameters in your View:

For example:

public class MyClass
{
    public IEnumerable<string> MyProperty { get; set; }
}

And in the Controller:

public ActionResult Index()
{
    // Create your model and set the values
    var myModel = new MyClass
    {
        MyProperty = new List<string> { "First Value", "Second Value" }
    };

    // Return the model back to your view for access using @Model
    return View(myModel);
}

You have to generate your own model for the form completion, and then pass all the objects (Ideally just one with many attributes) from the review page to the form filling page and vice-versa.

Albondi
  • 1,141
  • 1
  • 8
  • 19