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

  • SEARCH
  • Home
  • 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 7721205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:51:54+00:00 2026-06-01T03:51:54+00:00

Client side Validation and ValidationSummary is working fine for my project (MVC4 + Razor

  • 0

Client side Validation and ValidationSummary is working fine for my project (MVC4 + Razor + Unobtrusive JS) but the Server side errors are not shown on my view and if there was any client side error, it does not get removed from the view (it does from the ModelState). I have tried on both Chrome14 and IE9

Server side errors are being added to the model as ModelState.AddModelError(string.Empty, ModelState.AllErrors()); and shown to the view as @Html.ValidationSummary(false).

Edit

Simple form submit is working fine, it shows multiple error messages returned from the server and updates error messages, but, ajax based form submit is not working error messages returned by ajax based form submit are not shown at all.

Here is a sample demonstration of how the request is being made

    @*... View contents related to Master Model  ...*@
    @using (Ajax.BeginForm("ActionToAddRecord", new AjaxOptions()))
    {
        @Html.Action("ActionToAddRecord")
        <input type="submit" value="Add Record"/>
    }
    @*... View contents related to Master Model  ...*@

ActionToAddRecord is a partial view representing a model contained by a master model

Errors are returned as

[HttpGet]
public ActionResult ActionToAddRecord()
{
    return View();
}

[HttpPost]
public ActionResult ActionToAddRecord(childModel model)
{
    ModelState.AddModelError(string.Empty, "First error message");
    ModelState.AddModelError(string.Empty, "Second error message");
    return View(model);
}

Edit

I saw a similar functionality in templated MVC application by VS2010, the dialog based log in form. Error messages are returned as Json and then JS is being used to display them, IMO, seems like MS made Ajax based requests quite easy and concise (Ajax.BeginForm) but missing the error handling part. Right now i am not willing to use JS for this, there might be a better way to get this type of error handling dealt automatically.

  • 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. Editorial Team
    Editorial Team
    2026-06-01T03:51:55+00:00Added an answer on June 1, 2026 at 3:51 am

    Solved, with a small error.

    Master View

    @*Master View Contents*@
            @using (Ajax.BeginForm("AddPaymentCurrency", new AjaxOptions { UpdateTargetId = "paymentCurrency" }))
            {
                <div id="paymentCurrency"> 
                    @{Html.RenderPartial("PaymentCurrency", Model.PaymentCurrencyNew);}
                </div>
            }
    

    PaymentCurrency View

    @*Model Editors*@
    @Html.ValidationSummary(false)
    <input type="submit" value="Add Payment Currency"/>
    
    <div id="paymentCurrencyList" style="width:inherit; height:auto; overflow:auto;"> 
        @Html.Action("PaymentCurrencyList")
    </div>
    

    Controller

    [HttpPost]
    public ActionResult AddPaymentCurrency(PaymentCurrency model)
    {
        if (!ModelState.IsValid)
        {
            ModelState.AddModelError(string.Empty, ModelState.AllErrors());
            return View("PaymentCurrency", model);
        }
        //Add login
        return View("PaymentCurrency", model);
    }
    
    public ActionResult PaymentCurrencyList()
    {
        //var list = getList
        return View(list);
    }
    

    small error

    ValidationSummary is shown with fields highlighted and asterisk shown against them while adding invalid payment currency. Once a valid currency is added then ValidationSummary and asterisk is no more shown on invalid payment currency, just fields are highlighted.

    Please help me to get it fixed, i would prefer not to change the current structure, otherwise i will start getting big error

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Server side validation works great but client side will not work on some fields.
I want to have the ValidationSummary errors displayed during Client Side validation. Currently the
Our server side validation (via data annotations) is working great and posts the errors
I'm trying to integrate unobtrusive client-side validation in my ASP.NET MVC 3 project, as
I can't seem to get client side validation working with the version of MVC
I have a mixed client-side/server-side validation using jQuery validation plugin. The validation happens on
I have enabled unobtrusive client side validation in my app, and I have (something
I can't seem to get any client side validation working on a MVC 2
I need help figuring out how to succeed in implementing unobtrusive client-side validation of
My problem is I am using the MVC3's feature of unobtrusive client side validation

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.