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!

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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