Question

I know its possible to accept a list of objects as a parameter thanks to haacked but what about a list of Guids from checkboxes? This is a bit different as the only name you get has to be the ID.

Any help would be greatly appreciated, thanks!

Was it helpful?

Solution

I'm not sure if you can do Guids this way, since they don't expose a public setter property. I would suggest doing a List and then iterating over the list and using the Guid overload that takes a string:

public ActionResult Foo(IList<string> guidStrings) 
{
   var guids = new List<Guid>();
   foreach(var s in guidStrings)
   {
   guid.Add(new Guid(s));
   }

   return View(guidStrings);
}

Or something like that...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top