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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:28:53+00:00 2026-06-07T06:28:53+00:00

I am looking for a way to dynamically specify the format of my model

  • 0

I am looking for a way to dynamically specify the format of my model DateTime fields in the view. I need these to be editable (meaning I want changes to them to be properly bound to model on postback). I am not worried about validation as I will be using a jquery datepicker control on the resulting textboxes.

So far all I have found is a way of setting the format in data annotations in the model – which is way too static and restricting (unless there is also a way to modify data annotations at runtime?). Have also found guides for making templates for DateTime, but that is also static. Found some ways to format the fields in the view for “display only” requirements that won’t post back changes.

So far the only thing I have come up is having a separate string field for each DateTime field in all my models, do conversion in controllers manually before displaying only the string fields, and then convert them back. Before I embark on his messy approach, does anyone have any suggestions for an easier/cleaner way?

  • 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-07T06:28:54+00:00Added an answer on June 7, 2026 at 6:28 am

    You could technically write your own Annotation that will give you the dynamic format depending on your wants.

    These are evaluated at runtime so depending on what you want to return you can do it then.

    I am currently using attributes to return very specific data for specific uses.

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

Sidebar

Related Questions

I am looking for a way to format a floating point number dynamically in
I am looking for a way to dynamically set the window title for a
I'm looking for way to create list view as like in IOS with pinned
I am looking for the best way to dynamically arrange the location of labels
I am looking for a way to dynamically bind formulas throughout my DOM. We
I'm looking for a way to dynamically load a master page in order to
I'm looking for a way to dynamically click the browse button of a input
I have been looking for a way to dynamically load functions into c++ for
Minor quest - looking for a clean way to dynamically set the size of
Im looking for a way to dynamically create banners who can get placed on

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.