开发者

MVC3 razor remote validation - Controller argument is always empty

I can call the controller but the argument (string) is always null.

All the examples I have found name the controller argument the same as the property we are validating remotely, sounds good/easy, but if you look at fiddler what is really being passed in is the name attribute from the input statement. Well that is problematic in that it is a开发者_如何学运维 subscripted name something like Person.EMailAddresses[0].Address, well I can't name my controller parameter like that.

So how do I get around this? There must be a way to specify the controllers parameter name in the remote() attribute?


It cannot be done using the default RemoteAttribute. This is a link to an example I posted of a reusable remote validation attribute, where you can specify the name of the controller, action and the name of the variable used to pass the value to the action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜