Is it possible to accept List <Guid> as a parameter from checkboxes in Asp.Net MVC?

I know its possible to accept a list of objects as a parameter because of a hack , but what about a Guides list of checkboxes? This is slightly different as the only name you get should be an ID.

Any help would be greatly appreciated, thanks!

0


a source to share


1 answer


I'm not sure if you can do Guids this way since they don't expose a public setter property. I would suggest making a list, then iterating over the list and using a 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...

+2


a source







All Articles