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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:39:32+00:00 2026-06-01T23:39:32+00:00

I have an autogenerated class from importing a web service containing something like this

  • 0

I have an autogenerated class from importing a web service containing something like this (abbreviated):

[System.Runtime.Serialization.DataMemberAttribute()]
public System.DateTime StartDate 
{
    get 
    {
        return this.StartDateField;
    }
    set { /* implementation prop changed */ }
}

And I want to add an MVC format attribute to this member. So in another file containing the same partial class definition, I would like to do something like the following (which is illegal):

[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)] 
public DateTime StartDate;

A partial method is of no use here because partial methods must be private, have void return type, must be a method etc etc.

How can I decorate this member?

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

    You could use MetadataType attribute like this:

    [MetadataType(typeof(MyClass_Validation))]     
    public partial class MyClass
    {} 
    
    public class MyClass_Validation     
    {     
       [DisplayFormat(...)] 
       public DateTime StartDate { get; set; } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET web-service client that has been autogenerated from a wsdl-file using
Following on a bit from this question , if I have this class: private
I have something like this in Site.Master in an asp.net mvc3 (not razor) project:
i have my auto-generated linq to sql classes, and i extend this class using
I have a java class that I use to create a text file from
I have a class 'b' that inherits from class 'a'. In class 'a' there
Background I have made a Web Service in Visual Studio, and I'm trying to
I have a WorkerRole referencing a Class Library that calls some SOAP web services.
I have an AsyncTask which launches a DatabaseHelper class from DoinBackground which copies an
Im creating an autogenerated page from an XML-structure, it has the style like; <p

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.