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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:01:17+00:00 2026-06-05T23:01:17+00:00

I have a Supplier Entitiy that contains ID – int Status – string Name

  • 0

I have a Supplier Entitiy that contains

ID - int
Status - string
Name - string
CreateDate- datetime

I am using the partial class method to create Data Annotations for the above Entity.as described here

[MetadataType(typeof(SupplierMetadata))]
public partial class Supplier
{
    // Note this class has nothing in it.  It's just here to add the class-level attribute.
}

public class SupplierMetadata
{
    // Name the field the same as EF named the property - "FirstName" for example.
    // Also, the type needs to match.  Basically just redeclare it.
    // Note that this is a field.  I think it can be a property too, but fields definitely should work.

    [HiddenInput]
    public Int32 ID;

    [Required]
    [UIHint("StatusList")]
    [Display(Name = "Status")]
    public string Status;

    [Required]
    [Display(Name = "Supplier Name")]
    public string Name;
}

the HiddenInput annotation throws an error saying “Attribute ‘HiddenInput’ is not valid on this declaration type. It is only valid on ‘class, property, indexer’ declarations.”

Please help

  • 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-05T23:01:19+00:00Added an answer on June 5, 2026 at 11:01 pm

    The error states that that attribute can only be added to ‘class, property, or indexer declarations’.

    public Int32 ID; is none of these – it is a field.

    If you change it to a property

    public Int32 ID { get; set; } you will be able to decorate it with that attribute.

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

Sidebar

Related Questions

I have a Supplier Entitiy that contains ID - int Status - string Name
I have a supplier that wants a sitemap that contains much more meta data
I have a text box that I am the user enters a Supplier Name
I have the following code: class Orders{ /** * * @var Supplier */ private
We have a product that uses a Reference from a 3rd party supplier. With
I have a method that counts the number of Contacts each Supplier, Customer and
I Supplier class: public class Supplier { .... .... .... } I have also
I am trying to create form that contains another model in rails. I have
I have an MVC3 project that is using an EF4 project as its Domain.
I have a method that receives a category id, followed by two optional string

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.