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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:54:42+00:00 2026-06-06T16:54:42+00:00

I have a container and nested viewmodels and use EditorFor to render nested viewmodels,

  • 0

I have a container and nested viewmodels and use EditorFor to render nested viewmodels, i want to add remoteAttribute for validation to one of the properties in one viewmodel ( ConcreteViewModelA :: prop3). However, on the validation Controller action method, all i get is null.

I’ve tried using Validate([Bind(Prefix=”item”)]string prop3), but still comes back as NULL. any ideas?

public class SomeContainer
{
    public List<ISomethingViewModel> SomeViewModels { get; set; }
}

public class ConcreteViewmodelA : ISomethingViewModel
{
    public int prop1 { get; set; }
    public int prop2 { get; set; }
    [Remote("Validate", "RemoteValidation")]
    public string prop3 { get; set; }
}

public class ConcreteViewModelB : ISomethingViewModel
{
    public int prop1 { get; set; }
    public int prop2 { get; set; }
}

public interface ISomethingViewModel
{
    int prop1 { get; set; }
    int prop2 { get; set; }
}

View:

@model test.Models.SomeContainer

@using (Html.BeginForm())
{
    @Html.ValidationSummary()
    <p>Begin here</p> 
    foreach (var item in Model.SomeViewModels)
    {
        @Html.EditorFor(x => item)
    }        
}
  • 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-06T16:54:44+00:00Added an answer on June 6, 2026 at 4:54 pm

    Try defining a view model:

    public class MyViewModel
    {
        public string Prop3 { get; set; }
    }
    

    and then:

    public ActionResult Validate([Bind(Prefix = "item")] MyViewModel model)
    {
        return Json(
            !string.IsNullOrEmpty(model.Prop3), 
            JsonRequestBehavior.AllowGet
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a #main div nested within a container div that I want to
I have some nested tables where there is one outer, container table, two column
I have a container class which I would like to use to print all
Basically, I have a main container div with nested content. This div is has
I have an Ext.Container and I need to add to it a user-movable object.
I have these nested divs and I need the main container to expand (in
I have two <div> , one nested into the other defined like this: <div
I have a 2-level nested container (see below). When I click anywhere inside the
I have a jQuery function that finds all the images nested in a container
I have some nested SplitContainers and there is one undesired behaviour happening. Every time

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.