Solved

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

Posted on 2013-01-24
1
631 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 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

16 Experts available now in Live!

Get 1:1 Help Now