开发者

displaying validationSummary message in div element in asp.net mvc 2.0

开发者 https://www.devze.com 2023-01-22 11:33 出处:网络
I am doing validations in registration 开发者_开发技巧page.My requirement is if ValidationSummary error message is generated i,e,ValidationSummary is become true then i have to display that Validation

I am doing validations in registration 开发者_开发技巧page.My requirement is if ValidationSummary error message is generated i,e,ValidationSummary is become true then i have to display that ValidationSummary message in that div element.If error is not generated then that div element is not visible.

So i have to check whether Validationummary is true then div element is diplayed otherwise it will be hidden.So please tell me how to do this .

Initially i made the div Display:none.Now i have to make it display:visible when error generated.we can do this using javascript or what?


You could use the IsValid property of the model state.

<% if (!ViewData.ModelState.IsValid) { %>

<% } %>
0

精彩评论

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