1

Possible Duplicate:
RedirectToAction with parameter

I am in controller home, in ActionResult Id which has a list of string name get returned from a method. I want to RedirectToAction (Id2) using that list. In View -> Id2 the ViewData of that list name get is null, doesn;t contain the list of the Itemsn populated. How can I redirect from an actionResult to another view of another actionresult passing parameter?

Community
  • 1
  • 1
studentsss
  • 197
  • 5
  • 17

2 Answers2

2

Use like this

If there are more than one parameters then:

return RedirectToAction("actionname", new { id = "id", name="name" }); // change parameters according to requirement

If you have only id as parameter then:

return RedirectToAction("actionname", new { id = "id" });
Prasanth
  • 3,029
  • 31
  • 44
0
RedirectToAction( new RouteValueDictionary( 
     new{ 
          controller = "mycontroller", 
          action = "myaction", 
          id = "MyId" 
     } 
));
Henry
  • 1,010
  • 8
  • 10