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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:30:32+00:00 2026-06-09T02:30:32+00:00

I googled the problem too many times. But I couldnt find any solution to

  • 0

I googled the problem too many times. But I couldnt find any solution to do this.

I want to create a custom DataType with a default EditorTemplate and DisplayTemplate for use in mvc3 razor.

Model

[DataType("MyCustomDataType")]
public MyType Property { get; set; }
// I mean by MyType any type of data: string, int, datetime and so on

View – Razor

@Html.DisplayFor(m => m.Property)
//or
@Html.EditorFor(m => m.Property)

Actually I want to create a reuseable datatype with default editor-template and display-template.

Do you have any suggestion please? Can you give me a useful link or if you can, a simple example please? Thanks in advance.

  • 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-09T02:30:33+00:00Added an answer on June 9, 2026 at 2:30 am

    this is an excellent tutorial for custom editor/display template. Although its not in razor syntax, its easily convertible.

    If you want to create editor template depending on Datatype attribute, you can get the attribute value using ViewData.ModelMetadata.AdditionalValues["DataTypeAttribute"]

    If the value is your custom datatype value, do what ever you want. Otherwise, do the default.

    Not sure if it is a good idea. But it should work.

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

Sidebar

Related Questions

Googled everything, but can't find solution for my problem. When i'm trying to deploy
Yes, I've googled and I could not find the answer to this problem. First
EDIT: Too many edits :doh: I have identified the problem this time. There is
I googled for a long time, but didn't find full answer for my problem.
I'm new to WCF, and googled on that problem, but to no avail. I
I have searched/Googled around but I'm struggling with the following problem. I am building
Possible Duplicate: Problem with database in CodeIgniter Alright, I've googled this the last two
i googled for an hour now but maybe my Google-Fu is just too weak,
For some reason...maybe looking at too many different examples...this is one of those things
I'm trying to develop Apps for Android with ECLIPSE, but I have too many

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.