Customise Validation summary

Posted by cpoDesign on Stack Overflow See other posts from Stack Overflow or by cpoDesign
Published on 2011-06-20T09:10:44Z Indexed on 2011/06/20 16:23 UTC
Read the original article Hit count: 95

Filed under:
|

I have used html.ValidationSummary to get all errors displayed on top of the page. This will render list with errors on top of the page.

Example:

<ul>
<li>UserName is invalid</li>
</ul>

I have how ever need to render every item instead of list as custom div with additional html tags inside.

such as short example below:

<div>
<div class="right"><a href="#closeError">Close error</div>
<div class="right"><a href="#Update">Update Field</div>
<label>Error:</label> Name on the page is invalid.
</div>

What is your opininon how to achieve this rendering? I have considered to create html helper where i will take ModelState and get all errors, but not sure this will work...

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about validation