Home > DeveloperSection > Forums > How to redirect a user control to the view its called from?
Pravesh Singh

Total Post:411

Points:2881
Posted on    August-22-2014 1:37 AM

 ASP.NET MVC ASP.NET MVC 
Ratings:


 1 Reply(s)
 745  View(s)
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



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    August-22-2014 2:05 AM

Hi Pravesh, 
try this:

public ActionResult Save(SomeModel model)

{

   db.Save(model);

   return RedirectToAction("Index");

}


Don't want to miss updates? Please click the below button!

Follow MindStick