I am using the following code in a transformation on a custom document type, and the field in question is an integer (allows empty) using control type Document Selector called "Section":
<div class="section"><%# IfEmpty(Eval("Section"), "", "Relating to: <a href='" + GetROMChildUrl(Eval("Section")) + "'>" + GetROMSearchTitleForNode(Eval("Section")) + "</a>" ) %></div>
When the section is null, it causes a "specified cast is not valid". How can I get around this? It looks like the problem is doing an Eval on a nullable integer in the IfEmpty check?