Most of the actions in my controller have statically-defined parameter lists and so they correspond nicely with the standard tutorial examples:
public ActionResult SomeAction(string id, string arg1, string arg2)
{
// use arg1, arg2...
}
But I have one troublesome case where the view puts together a form dynamically, so the set of parameters is completely dynamic. I'd be happy with a mapping of string names to string values.
I've tried this:
public ActionResult TroublesomeAction(string id, IDictionary<string, string> args)
{
// loop through args...
}
But args
is passed a null
. What's the easiest way in an action to get hold of the famous "parameter dictionary" that we hear so much about in error messages these days?
And if there isn't an easy way, how would I do it the hard way?