0

Basically I have a list of Guids and I want to pass this list as a parameter to a controller action. This is what I come up with so far, but its not working.

var contactsParam = new Dictionary<string, object>();
var count = 0;

foreach (var selectedUserId in selectedUserIds)
{
    contactsParam.Add("selectedUserId[" + count + "]", selectedUserId);
    count++;
}

@Html.ActionLink("Edit", "SomeAction", "Controller", new RouteValueDictionary(contactsParams), null)

Then this is the controller action

[HttpGet]
public ActionResult SomeAction(Guid[] selectedUserIds)
{}

I've tried to pass through just a basic list on its own, and also an IEnumerable, however they both send through 0 results. I've searched online and found what I have above, but it doesn't seem to be working.
Can you suggest anything?

Ben
  • 187
  • 3
  • 12
  • Ok, Well after more research I've found that there is apparently no where of passing a complex type through an action link as a GET. So I guess I will just have to use TempData or something. – Ben Apr 03 '14 at 16:10

1 Answers1

0

I think I've just passed them as strings and converted them on the other end. Not very elegant I know.

Mathew Padley
  • 102
  • 1
  • 8