Questions tagged [display-templates]

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.

102 questions
1
vote
1 answer

Sharepoint 2013 search results custom grouping display template

I am trying to implement custom grouping for search result items. I would like to group them by a managed property, but without using result blocks (query rules). The idea is to sort the results by the property and then compare the current item…
1
vote
2 answers

Can I have a named display template for a collection

I have a display for a collection of "SomeObject" public List SomeObjects @Html.DisplayFor(m => m.SomeObjects) This all works fine.. Then I had a requirement that meant I would need a second different display template for the same…
John
  • 698
  • 1
  • 11
  • 22
1
vote
3 answers

DisplayForModel not rendering my iList(of string)

I have a model, which has a few regular properties like strings and integers, and it also have 2 ilist(of string) properties. I made a DisplayTemplate for these that looks like this and is called ListOfString.vbhtml: @ModelType List(Of String) @If…
Patricia
  • 7,752
  • 4
  • 37
  • 70
1
vote
1 answer

No results message using display templates

I have a sharepoint 2013 site with a page that uses the CSWP and a custom display template. When there are no results, I want to display a message that says "Share What's Going On". I tried setting the $noResults variable in the display template,…
user151190
  • 91
  • 2
  • 13
1
vote
1 answer

JavaScript/jQuery doesn't work on Editor/Display templates loaded with Ajax

I created editor and display templates for my entire object downline. Now one of the inner objects' text boxes should be a date-picker. The thing is it's loaded after the initial loading using Ajax, and the included scripts don't work. I tried to…
1
vote
1 answer

How to get a property from a Model when writing a display template

I have a model... public class PatientACOModel { public int EncounterId { get; set; } public int PatientId { get; set; } public int EMPIID { get; set; } public int PopulationPatientID { get; set; } public string…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
1
vote
1 answer

Why isn't MVC4 looking in the Area-specific Views/Shared/DisplayTemplates folder?

Trying to move some code from an MVC3 project to an MVC4 project, and running into this issue. There are some DisplayTemplates within an area, like so: MVC…
1
vote
1 answer

Use ASP.NET MVC DisplayTemplate implicitly

I have some code like this in a cshtml view @{ int i = 0; foreach (var record in Model.Records) { @record.CreatedDate @Html.DisplayFor(x => x.Records[i].CreatedDate) i++; …
politus
  • 5,996
  • 1
  • 33
  • 42
1
vote
2 answers

How to create and implement a custom datatype in mvc3 razor

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…
0
votes
1 answer

C# MVC 3 Razor - Call DisplayTemplate with DisplayTemplate

I have a simple product list, the products fall into two distinct categories and are displayed differently on the page depending on their category id. Is it at all possible to nest DisplayTemplates of the same Model type…
Rob
  • 10,004
  • 5
  • 61
  • 91
0
votes
1 answer

MVC 3 Razor - Create DisplayTemplate for specific Property Name e.g. WebsiteUrl, IsActive

I have very strict naming conventions for my models and I am wondering if I can leverage this via display templates for common fields like - WebsiteUrl, IsActive, UpdateDate, InsertDate? Is it possible to create a Display Template based on a…
Rob
  • 10,004
  • 5
  • 61
  • 91
0
votes
1 answer

Asp.Net 5 Core DisplayFor() Publish Bug

I am porting some code from Asp.net 4.7 to Asp.Net 5 Core. The code is using a foreach statement to loop through records. It is using the legacy "DisplayTemplates" functionality that matches types in the DisplayTemplates folder to polymorphically…
WillC
  • 1,761
  • 17
  • 37
0
votes
2 answers

Razor Page Display Template for SSN stored as a Varchar(9)

I am trying to display SSN stored as Varchar(9) with dashes. The SSN in the database is stored as a varchar(9), with no dashes. It is not stored as a numeric because any leading zeros are dropped if it is stored as a numeric. I cannot use the…
0
votes
1 answer

SharePoint 2013 - Need to Split Names from a Multi-Select People Picker

I'm working in SharePoint 2013, and I have created a custom display template for a Content Search Web Part. Three of my fields use multi-select people pickers, and all three are returning the names in one string as shown below: Brown, JohnSmith,…
Tom Molskow
  • 23
  • 1
  • 5
0
votes
1 answer

Need to Format Date in a SharePoint Content Search Web Part Display Template

I'm working in SharePoint 2013, and I have created a custom display template for a Content Search Web Part. Three of my fields use dates, and all three are returning the dates in long format. I want to return the dates in short format but I just…
Tom Molskow
  • 23
  • 1
  • 5