How to redirect a user control to the view its called from?

Total Post:412

Points:2888
 1270  View(s)
Ratings:
Rate this:

I have a user control that creates a new record in a database. After it creates the new record, I would like to redirect it back to the view its from. The purpose of this is to refresh the view so that it can show the newly created record. The problem is that user control can exists in more than one view, so how can i know which view is the user control from? so that I can achieve the above scenario? Thanks

  1. Post:378

    Points:2694
    Re: How to redirect a user control to the view its called from?

    Hi Pravesh, 

    try this:
    public ActionResult Save(SomeModel model)
    {
       db.Save(model);
       return RedirectToAction("Index");
    }

      Modified On Apr-04-2018 06:25:20 AM

Answer