UpdateModel prefix - ASP.NET MVC

后端 未结 4 1241
悲哀的现实
悲哀的现实 2020-12-29 12:23

I\'m having trouble with TryUpdateModel(). My form fields are named with a prefix but I am using - as my separator and not the default dot.

<         


        
4条回答
  •  粉色の甜心
    2020-12-29 13:15

    Not unless you implement your own ModelBinder. If you look at the source code for the DefaultModelBinder on www.codeplex.com/aspnet, you'll see that when you specify a prefix it constructs the name by concatenating the prefix, a period, and the name of the property. Unfortunately, the method on DefaultModelBinder that does this is private static and thus cannot be overridden in a derived class.

提交回复
热议问题