Solved

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

Posted on 2013-01-24
1
641 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

751 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