Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 133225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:23:34+00:00 2026-05-11T06:23:34+00:00

I have a strange problem whereby the ValidationSummary is not being displayed. However, the

  • 0

I have a strange problem whereby the ValidationSummary is not being displayed. However, the ValidationMessage’s are being displayed. I’ve checked the output page source and it’s not as though they are in a colour that is obscuring them. I’m using the RC. Any ideas?

Edit: Break point set at ValidationSummary shows:

ViewData.ModelState.Values[1].ErrorMessage = '' ViewData.ModelState.Values[1].Exception.InnerException.Message = '4a is not a valid value for Int32' 

Does ValidationSummary use ErrorMessage and ValidationMessage use InnerException.Message?

My view code is:

<%@ Page Title='' Language='C#' MasterPageFile='~/Views/Shared/Site.Master' Inherits='System.Web.Mvc.ViewPage<App.Models.PurchaseOrdersView>' %>   <asp:Content ID='Content1' ContentPlaceHolderID='head' runat='server'>     <title>Edit</title> </asp:Content>  <asp:Content ID='Content2' ContentPlaceHolderID='MainContent' runat='server'>      <h2>Edit</h2>      <%= Html.ValidationSummary() %>      <% Html.BeginForm('Edit', 'PurchaseOrder', FormMethod.Post); %>     <table>         <tr>             <td>                 Purchase Order Id:             </td>             <td>                 <%= Html.TextBox('PurchaseOrderId', Model.PurchaseOrderId)%>                 <%= Html.ValidationMessage('PurchaseOrderId')%>             </td>         </tr>         <tr>             <td>                 Date:             </td>             <td>                 <%= Html.TextBox('Date', Model.Date.ToString('dd-MMM-yyyy'))%>                 <%= Html.ValidationMessage('Date')%>             </td>         </tr>     </table>     <input type='submit' value='Save' />      <% Html.EndForm(); %>  </asp:Content> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:23:35+00:00Added an answer on May 11, 2026 at 6:23 am

    You don’t say what the errors are that are not displaying, but there are some errors which will be displayed in ValidationMessage but not in ValidationSummary. I think that this is a bug in the Release Candidate, but I am open to other interpretations. In particular, consider this line from the ValidationSummary source code:

    string errorText = GetUserErrorMessageOrDefault(modelError, null /* modelState */); 

    Note that nothing is passed for modelState. Now contrast that with ValidationMessage:

    ... GetUserErrorMessageOrDefault(modelError, modelState) ... 

    Finally, let’s look at GetUserErrorMessageOrDefault:

        private static string GetUserErrorMessageOrDefault(ModelError error, ModelState modelState) {         if (!String.IsNullOrEmpty(error.ErrorMessage)) {             return error.ErrorMessage;         }         if (modelState == null) {             return null;         }          string attemptedValue = (modelState.Value != null) ? modelState.Value.AttemptedValue : null;         return String.Format(CultureInfo.CurrentCulture, MvcResources.Common_ValueNotValidForProperty, attemptedValue);     } 

    What this tells us is that if you specify a custom error message when you add an error to the model state, it will be displayed. If, however, an exception is added (there is one overload for AddModelError which takes an exception, another which takes a string; implementing IDataErrorInfo works like the string case), instead of a string error message, it will only be displayed if modelState is non-null, and then we’ll give you a generic message instead of the error message on the exception.

    Update

    Does ValidationSummary use ErrorMessage and ValidationMessage use InnerException.Message?

    Yes, that’s more or less the effect. Like I said, I think this is a bug.

    Update2

    Microsoft updated the GetUserErrorMessageOrDefault function as seen here.

    private static string GetUserErrorMessageOrDefault(HttpContextBase httpContext, ModelError error, ModelState modelState)     {         if (!String.IsNullOrEmpty(error.ErrorMessage))         {             return error.ErrorMessage;         }         if (modelState == null)         {             return null;         }          string attemptedValue = (modelState.Value != null) ? modelState.Value.AttemptedValue : null;         return String.Format(CultureInfo.CurrentCulture, GetInvalidPropertyValueResource(httpContext), attemptedValue);     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer This will get the ProgId rather than the ClassId, and… May 11, 2026 at 12:47 pm
  • added an answer Here you go. It has something to do with your… May 11, 2026 at 12:47 pm
  • added an answer To 'clean' a build means to delete all intermediate and… May 11, 2026 at 12:47 pm

Related Questions

I have a strange problem with mod_rewrite, the rules that are relevant here are:
I have a strange problem with VS2008. My solution has 8 projects (all c#)
I am seeing a strange problem: I have a linux machine, installed JDK1.6 on
I have a very strange problem. Under some elusive circumstances I fail to apply
I have a very strange problem, when I try to var_dump (or print_r )
I have a strange problem in my project. I have a class that inherits
I have a strange problem with the jQuery accordion plugin and IE7 (and maybe

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.