0

I wanted to know how to pass a list(of string) values from one controller to another controller action. I have read that we can use TempData etc, but it is not working for me. Initially I passed like this

Return RedirectToAction("Summary", New With {.id = id,.value = valList})

But when it redirected to the new action, the list values would be null.

Then I used the TempData funda, with the following code.

If check = 0 Then
                                objValues.Add("true")
                                objValues.Add(terminationReason)
                                objValues.Add(getValueStr("txtNote", fc))
                                TempData("objValues") = objValues
                                Return RedirectToAction("Summary", New With {.id = id})
                            End If

But after the If loop is executed, I get the option in the status bar whether to Save, open or download a file, and then the processing stops.

Any help on this front would be great.

Thanks In advance.

Siddharth
  • 436
  • 2
  • 11
  • 29
  • While using `Return RedirectToAction("Summary", New With {.id = id,.value = valList})` ,did you declare those variable in that action with the same name or not? – Shashank Sood Sep 07 '16 at 06:46
  • Yes I did, and also I have declared it as an optional parameter as it will be used only for specific cases. So the action result is Function Summary(ByVal id As Integer, Optional valList As List(Of String) = Nothing) As ActionResult – Siddharth Sep 07 '16 at 06:53
  • Also is the order of parameters also important. As I have 2 parameters in between id and valList. – Siddharth Sep 07 '16 at 06:59

0 Answers0