jQuery Validation remote with invalid variable name: How to fix?

后端 未结 1 1894
故里飘歌
故里飘歌 2020-12-12 05:54

I\'m using remote validation with jQuery Validation.

I\'m trying to call my server side code in MVC but the problem is that my variable is in a nested class:

1条回答
  •  伪装坚强ぢ
    2020-12-12 06:17

    You can use the Prefix property of BindAttribute to effectively 'strip' the prefix.

    public JsonResult Validate([Bind(Prefix="HouseState.Name")]string Name)
    

    so name="HouseState.Name" becomes just Name when binding

    0 讨论(0)
提交回复
热议问题