25Aug/100

Sitecore – FieldRenderer.Render(item, fieldname) returning “” empty string

Today I spent 2 hours trying to debug why FieldRenderer.Render() was returning an empty string.

It was working yesterday and the code didn't change, so what was it?

Digging a little deeper I found this in the immediate window of VS2008.

FieldRenderer.Render(item, constants.content.title.ToString())
""
item[constants.content.title]
"Frequently Asked Questions (FAQs)"
item.Fields[constants.content.title]
""-{D5A4F329-B904-4D6D-8503-392BD87B18A6}
CanRead: true
CanWrite: true
ContainsStandardValue: false
Database: {web}
Definition: null
Description: ""
DisplayName: ""
HasBlobStream: false
HasValue: true
HelpLink: ""
ID: {D5A4F329-B904-4D6D-8503-392BD87B18A6}
InheritedValue: "Frequently Asked Questions (FAQs)"
IsBlobField: false
IsModified: false
"faqs": faqs (en#1@web), id: {B4B6124D-D94B-436D-A3B7-29FD8BE4ADA0}
Key: ""
"en": "en"
Name: ""
ResetBlank: false
Section: ""
SectionSortorder: 0
Shared: false
ShouldBeTranslated: false
Sortorder: 0
Source: ""
Style: ""
Title: ""
ToolTip: ""
Translatable: false
Type: ""
TypeKey: ""
Unversioned: false
Validation: ""
ValidationText: ""
Value: "Frequently Asked Questions (FAQs)"
So obviously there is a value in there, so why is it returning empty string?
As it turns out, the template that had the referenced field was removed as an inherited template for that item. I'm not sure how - or who did it but it was removed. Simply adding the template to the inherited template restored my page to how it should have been.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.

Close
E-mail It