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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:37:32+00:00 2026-05-26T11:37:32+00:00

In my project we have some editor templates that render html like the following:

  • 0

In my project we have some editor templates that render html like the following:

<table>
   <tr>
       <td><image src="/SIIJYP/Content/Images/lupa.bmp" id="@(controlId)img"/></td>
       <td>
           @Html.Hidden("Id", Model.Id)
           @Html.TextBox("Fullname", Model.Fullname, new {@readonly="readonly"})
       </td>
   </tr>
</table>

This looks like a little image next to a textbox and it is used to allow searching and selecting a person from a people search pop-up window.

Models which use this template have properties as follow:

public class MyModel
{
    [Required(ErrorMessage="This value is required")]
    [UIHint("PeopleSearch")]
    public Person Responsible { get; set;}
}

All works perfectly, template is rendered propertly, values are posted, model is validated, etc. However, when user does not select a person and posts, the expected error message “This value is required” is not displayed.

How should we modify our template to display the message when any value is provided by the users?

UPADATE: Person model definition:

public class Person
{
    public long Id { get; set;}
    public string Fullname { get; set;}
}

What I need is a way that allows me to use the RequiredAttribute in the Responsible property to validate that both: Id and Fullname have values and display the error message below the textbox otherwise.

  • 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-05-26T11:37:33+00:00Added an answer on May 26, 2026 at 11:37 am

    As stated in the comments, you forgot to put in the html

    @Html.ValidationMessageFor(model => model.Responsible.Name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On a small embedded system project we have some code which we would like
I have a project where there are multiple applications that have some common configuration
I have a project in a c++ solution. For that project, I have some
I have some code in my project that saves an object to the database,
I'm working on a project where I have some hierarchical data that I want
I have some IronPython scripts that are embedded in a C# project, and it
On an ASP.NET-MVC2 project, I have built some user controls that resides in Views\Shared\EditorTemplates
I have an opened project in Eclipse . I have some special extensions like
I'm using FreeTextBox HTML editor in some webforms in my asp.net project . if
On a recent project I have been working on in C#/ASP.NET I have some

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.