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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:58:17+00:00 2026-05-26T08:58:17+00:00

I have the following model Public Class BaseViewModel Public Property Id as integer Public

  • 0

I have the following model

Public Class BaseViewModel

Public Property Id as integer
Public Property Title As String

<DisplayName("Creation Date"), Required(), ScaffoldColumn(False)>
Public Property DateCreation As String
<DisplayName("Creation User"), Required(), ScaffoldColumn(False)>
Public Property UserCreation As String
<DisplayName("Modification Date"), ScaffoldColumn(False)>
Public Property DateModification As String
<DisplayName("Modification User"), ScaffoldColumn(False)>
Public Property UserModification As String

End Class

I’ve created a partial view named BaseViewModel that has the following HTML

<div id="Detail-Item" class="hidden">
@Using Html.BeginForm("Save", "Agency", Nothing, FormMethod.Post, New With {.id = "Detail-form"})
@<fieldset>
    <legend>Agency</legend>
    @Html.ValidationSummary()
    <div class="editor-label"> 
        @Html.LabelFor(Function(model) model.Id):
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(Function(model) model.Id, New With {.class = "textbox-id input-key textbox-inactive", .data_field = "Id", .readonly = "readonly"})    
        @Html.ValidationMessageFor(Function(model) model.Id, "*")
    </div>
    <div class="editor-label">
        @Html.LabelFor(Function(model) model.Title):
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(Function(model) model.Title, New With {.class = "textbox-name input-text focus", .data_field = "Title"})
        @Html.ValidationMessageFor(Function(model) model.Title, "*")
    </div>

    <div class="hidden">
        @Html.Hidden("UserCreation", String.Empty, New With {.class = "input-audituser", .data_field = "UserCreation"})
        @Html.Hidden("UserModification", String.Empty, New With {.class = "input-audituser", .data_field = "UserModification"})
        @Html.Hidden("DateCreation", String.Empty, New With {.class = "input-auditdate", .data_field = "DateCreation"})
        @Html.Hidden("DateModification", String.Empty, New With {.class = "input-auditdate", .data_field = "DateModification"})
    </div>
</fieldset>
End Using
</div>

To render this view I’m using @html.EditForModel. My problem is that even I’m using Html.Hidden for DateCreation and UserCreation model properties the Html generated for these fields contain the “required” data validation attribute.

Is this the way it should work?, if yes how can avoid that?

  • 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-26T08:58:18+00:00Added an answer on May 26, 2026 at 8:58 am

    Given the model you have provided, that is the expected behavior. The model designates both properties as Required, so the hidden fields will have unobtrusive validation attributes added.

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

Sidebar

Related Questions

I have following model: public class FormularModel { [Required] public string Position { get;
So I have the following model: public class Person { public String FirstName {
I have the following model in MVC: public class ParentModel { public string Property1
I have the following Model: public class Person { public string Name {get;set;} public
I have the following Entity model: public class Todo { [Required] public int ID
ok say i have the following model: public class bar{ public string bar {get;
I have the following domain model: public class Name { private readonly string fullName;
I have the following model: public class Person { public string Name { get;
I have the following model : public class ContratoDetailsViewModel { [StringLength(50)] [RegularExpression(^[a-z0-9_\\+-]+(\\.[a-z0-9_\\+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,4})$)] [DisplayName(E-Mail Adm.)]
I have the following view model: Public Class MyViewModel Public Property SelectedIDs As List(Of

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.