Question

Here's the item from the View

 @Html.EditorFor(Function(model) model.BirthDate)

Here's the code from the EditorTemplate (simplified)

@ModelType Date?
<span>
    @Html.TextBox("", Model)
</span>

but the output doesn't have the span tags.

The datatype of the model.BirthDate is Date?

The folder structure is

  • Views
    • Shared
      • EditorTemplates
        • Date.vbhtml

EDIT

Ok, so after some digging, I found that if I add <UIHint("Date")> to my BuddyClass, then the template works.

So my "new" question would be... why wouldn't it pick this up by default?

Was it helpful?

Solution

Well. @Brad Wilson answered my question over at the asp.net forums.

The default template name is based on the CLR type name, in this case DateTime. "Date" is a shortcut name in VB, not the real type name (much like "int" in C# is really a shortcut for CLR's "Int32")

Now I get it. Thanks @Brad

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top