Explanation: I have a grid with a checkbox column where users can check records they want to view details of. Each checkbox has a value of the ID of that object. I want to then pass these values to a controller action so that I can render a paged view, as it were.
Now, what I have right now is technically working, but it’s ugly and something tells me there’s a better way. Right now I’m creating a JSON string of the array values and passing that, so the route ends up looking like “/Products/Details/[“4″,”5″,”6″]”
Now, as I said, this works and I can parse out the values in the controller, but something tells me I shouldn’t have to. Am I missing something simple, or does someone know of a decent way of doing this? The number of values can be arbitrary based on what the user has selected, so I can’t create a custom route (I don’t think, anyway).
Thanks, all.
If you haven’t read Phil Haacked – Model Binding To A List I would highly recommend starting there, it should help alot.