Display template is a html template which can be repeat for each item in its model and it will load in specific section of a view of asp.net web application. A template can have styles/scripts or Razor codes in itself also.
Questions tagged [display-templates]
102 questions
3
votes
2 answers
MVC Razor display template
I have a list of items that I am passing to a view. I would like to render each item using a display template. However, something is wrong, as I don't get the field properly rendered.
Here is my main view (Index.cshtml):
@model…

laconicdev
- 6,360
- 11
- 63
- 89
3
votes
2 answers
MVC4 Razor DisplayTemplate called, HTML generated, but not rendered to browser
I've got a view that iterates a collection and calls DisplayFor() for each element in the collection.
I need to manually iterate (as opposed to passing the collection to DisplayFor) in order to tell the template if a break in the list should be…

JoeBrockhaus
- 2,745
- 2
- 40
- 64
2
votes
0 answers
How do you embed a razor EditorFor View
I have a composable web application where the user enters an item number and one of a number of processors is invoked to handle the action based on what type of item it is. Each "processor" is in a seperate .dll and can be dropped into the…

runxc1 Bret Ferrier
- 8,096
- 14
- 61
- 100
2
votes
1 answer
ASP.NET MVC 3: Output specific view for concrete implementation
I have an IEnumerable of a base type as my model.
I need to display a different bit of HTML in a list depending on what the concrete type is.
So the resulting list might look similar to this in HTML:
- Points - Item 1 - 10…

Rob Stevenson-Leggett
- 35,279
- 21
- 87
- 141
2
votes
1 answer
Is there any way to use Editor and Display templates with Dictionary in ASP.NET MVC3?
I usually make use of the Editor and Display templates when my model (or submodels) are List objects. This way I avoid to "spoil" my code with several foreach constructs.
I wanted to know whether there is any way to use Editor and Display…

CiccioMiami
- 8,028
- 32
- 90
- 151
2
votes
2 answers
MVC DisplayFor Not Rendering
I am having an issue with a custom display template in an MVC 5 application. I have a viewmodel that contains a complex type that I wanted to reuse. I created the DisplayTemplates folder and placed a partial view that follows the correct naming…

Clayton Page
- 95
- 1
- 13
2
votes
1 answer
What is use of UIHint attribute in ASP.Net MVC
just reading about UIHint from this url What is use of UIHint attribute in MVC
If you annotate a property with UIHint attribute
and use EditorFor or DisplayFor inside your views,
ASP.NET MVC framework will look for the specified
template which…

Mou
- 15,673
- 43
- 156
- 275
2
votes
1 answer
MVC DateTime format can not be parsed
after recently upgrading from MVC3 to 4 I am having some issues with datetimes. I display a date property like this:
<%: Html.DisplayFor(m => m.InvoiceDate, "datetime")%>
"datetime" is a display template which looks like this:
<%@ Control…

Toby Holland
- 1,029
- 2
- 14
- 29
2
votes
2 answers
ASP.NET MVC 3 Razor DisplayFor Delegate
I'm getting this error:
Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
Here's my code (custom HTML helper, wrapping DisplayFor so i can choose a…

RPM1984
- 72,246
- 58
- 225
- 350
1
vote
2 answers
Why isn't ASP.NET MVC 3 resolving my DisplayTemplate for a complex type?
I've been using DisplayTemplates/EditorTemplates for relatively simple types, like DateTime and DateTime?, etc. Now I want to use it to render a more complex type that is handing off my view model. The complex type is basically an entity from EF.…

Paul Mrozowski
- 6,604
- 9
- 34
- 47
1
vote
1 answer
MvcSiteMap - NullreferenceException when iterating over the Model.Nodes. (ASP.NET MVC3 Razor)
I have some problem with MvcSiteMap. I get NullreferenceException when interating over Model.Nodes because Model is NULL.
I got it working with @Html.MvcSiteMap().Menu() but when I try the samples from your DisplayTemplate I get that…

n3tx
- 429
- 2
- 10
- 23
1
vote
0 answers
How to set the DisplayFormatString property on ModelMetadata object in razor-engine?
I have an Asp.Net MVC 5 project. I am trying to utilize the DisplayTemplates to make my view more dynamic.
I am trying to create a display-template for any DateTime property. But I am unable to set ViewData.ModelMetadata.DisplayFormatString…

Junior
- 11,602
- 27
- 106
- 212
1
vote
1 answer
Default output for DisplayTemplate of a class
We are building a class library that provides certain structured types for the view model, e.g. InlineImage.
I need to be able to define default HTML output for such instance when used with @Html.DisplayFor(...), basically ...
When…

martinh_kentico
- 913
- 7
- 17
1
vote
0 answers
content type description value in Content search web part
In content search web part using managed property (ContentType), i am able to get content type "Title" for the list items.
but my problem is i need to fetch content type "Description" not the title. I have searched for content type description…

Milan Jain
- 21
- 3