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 8659725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:04:50+00:00 2026-06-12T16:04:50+00:00

I have a problem i am trying to solve. I have a grid (tabular)

  • 0

I have a problem i am trying to solve.

I have a grid (tabular) type layout that will contain a collection of ViewModels.

I want to be able to validate those ViewModels and then turn the cells for a given property red if it contains error:

      Prop 1 | Prop 2 | Prop 3 | Prop 4
Row 1   x    |        |   x    |
Row 2   x    |    x   |        |   x
Row 3        |    x   |   x    |

x = Red Cell

My question is how do I do this using model state that is filled from a service layer?

I am using AutoMapper to map Domain Objects (POCO) to ViewModels, where the POCO’s are supplied by a service layer.

So basically:

Controller –> Service –> Returns Domain Object –> Maps to view models –> handed to view.

The business logic is in the service layer and I was thinking of passing in a model state wrapper to the service to fill the model state with errors from the domain objects.

I would assume some sort of key?

I know that model state is per property right?

Thanks!!

  • 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-12T16:04:51+00:00Added an answer on June 12, 2026 at 4:04 pm

    It’s not very clear how are you performing the validation at your service layer but at the end of the day the following items in your ModelState must have errors associated to them:

    Items[0].Prop1
    Items[0].Prop3
    Items[1].Prop1
    Items[1].Prop2
    Items[1].Prop4
    Items[2].Prop2
    Items[2].Prop3
    

    Where Items is the name of the collection property on your view model. So you will have to add those errors to the ModelState with those keys.

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

Sidebar

Related Questions

I'm trying to solve the following problem in Redis. I have a list that
I have problem that im trying to get solve for like week. My goal
Here's the problem I'm trying to solve: I have a dynamic php-driven website that
I have a problem that I have been trying to solve for a couple
I have little problem that I have been trying to solve for some time.
The problem I am trying to solve is: I have 6 stripes which I
I have an interesting problem here I've been trying to solve for the last
Here is a problem I am trying to solve: I have an irregular shape.
I have been trying to solve this problem for a while, but couldn't with
I am trying to solve the following problem with Puppet: I have multiple nodes.

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.