SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This post is the same as Override the custom field rendering in a list view, but I don't have the ability to ask a question to an answered post. I was hoping Stuart Pegg could elaborate on his answer.

I've been trying to figure out the final step I have to complete my custom field. Simply put, the user inputs a date, I store it as an int64 in the SPListItem, and then when I need to display it, I convert it back from int64 to the date.

However, in the view of the list (AllItems.aspx), it always displays the int64.

The class inherits SPField, and I've overridden the GetFieldValueAsText, but it is never triggered.

Stuart had mentioned that GetFieldValueAsText works for "most" fields. Why isn't it being triggered for a class inheriting SPField?

I've read that I need to use XLST to display properly in a view, but how can a XLST use .NET functions?

Any help provided is greatly appreciated!

share|improve this question
up vote 2 down vote accepted

Well, for what it's worth, here's what I found out.

  1. There is no ddwrt function to convert ticks or binary to a DateTime object.
  2. Since AllItems.aspx appears to utilize XsltListViewWebPart, I couldn't find a way to add my own custom XSLT namespace/functions.
  3. My current SPField was using returning typeof(long) for FieldValueType. I guess since SharePoint thinks it knows how to render a long, it ignores GetFieldValueAsText/GetFieldValueAsHtml.
  4. I changed FieldValueType to return typeof(MyCustomFieldValue). All MyCustomFieldValue does is expose a long property and a few static functions. This caused SharePoint to call GetFieldValueAsText/GetFieldValueAsHtml.
share|improve this answer
Thank you so much! You just saved my day – MdMazzotti Oct 10 '14 at 17:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.