addmodelerror

View the Validation summery in the required place

淺唱寂寞╮ 提交于 2020-01-16 00:27:06
问题 I have a partial view in a main view in mvc3. The partial view has it's own ModelState.AddModelError in its action method and the main view has another ModelState.AddModelError in its action method. When the code runs and the main view error wants to be displayed, as the partial view also has the validationsummery tag, the validation summery shows up in both places. How an I fix this issu?? Thanks. 回答1: You can do this by jquery $(function(){ var error = ""; $("classnameOfvalidationsummarydiv