Solved

mvc 3 c#: What is preferred methodology for passing notifications/messages from service layer

Posted on 2013-01-24
1
632 Views
Last Modified: 2013-01-30
I am developing a .net mvc 3  c# application and I am currently using a ModelStateWrapper to pass messages from the service layer to the controller.  The question is, considering that the underlying ModelStateDictionary is based upon key/value pairs, what key would I need to tell the view to display this message along with the form-based errors?  When the validation summary is called.
0
Comment
Question by:rawcoder
1 Comment
 
LVL 22

Accepted Solution

by:
ambience earned 500 total points
ID: 38821108
ModelState has a collection of errors for each key and I believe if you add with the empty key the messages are displayed as form level summary but otherwise if the keyname matches field name (I'm not 100% sure of this) then it appears as field level validation message.

In short, if the message is specific to a field (which should really not be coming from the service layer though) but if it is then the fieldname can be the key otherwise just the empty keyname.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now