asp.net mvc 3 - MVC3 pass exception from controller to view -


want print exception on cshtml page, unbale use this

 @html.validationsummary()       <form method="post" action="adduser">    </form> 

you should add error message in action this.

modelstate.addmodelerror(string.empty, "error message."); 

and use @html.validationsummary() in view.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -