MVC3 Html.BeginForm - passing arguments as RouteValueDictionary fails

后端 未结 4 1410
梦毁少年i
梦毁少年i 2021-01-05 05:04

I have a multi-step setup process where I would like to pass query string arguments appended to the URL only if they are relevant.

http://localhost:6618/Account/Prof

4条回答
  •  暖寄归人
    2021-01-05 05:06

    So you're using this overload:

    http://msdn.microsoft.com/en-us/library/dd460542.aspx

    Is it possible to make args a simple object with keys and values? I think that might solve your problem.

    According to docs:

    The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. - this seems to be what is happening-- it's using reflections to get the properties of route dictionary- the properties being keys (collection of string) and values (collection of objects)

    Another option would be to not use the html helper and create the form tag manually-- although that would kind of defeat the purpose of having the html helpers.

提交回复
热议问题