Thanks for the quick response. I was already using custom functions, so thanks for the added code help.
It seems, that nodeGuidParam is null or not set past the "try" statement and is throwing an exception if the code is left as previously posted. I am able to get the nodeGuidParam when the exception is thrown.
I tried changing the first if statement to == null (see test code below)and it will pass the first if statement since nodeGuidParam appears to be null at that point.
I know enough C# to get me in trouble, so I may be doing something wrong. Any suggestions would be appreciated.
This is what I am uing in my transformation.
<%# MyFunctions.ReturnUrlSrc(Eval("AudioFile").ToString()) %>
//Test Code
public static string ReturnUrlSrc(string nodeGuidParam)
{
try
{
if (nodeGuidParam == null && nodeGuidParam.Trim() == "")
{
string nodeGuidStr = ValidationHelper.GetString(nodeGuidParam, "");
Guid nodeGUID = new Guid(nodeGuidStr);
if (nodeGUID != null)
{
int nodeId = CMS.TreeEngine.TreePathUtils.GetNodeIdByNodeGUID(nodeGUID, CMS.CMSHelper.CMSContext.CurrentSiteName);
if (nodeId != null)
{
CMS.TreeEngine.TreeProvider tp = new CMS.TreeEngine.TreeProvider(CMS.CMSHelper.CMSContext.CurrentUser);
CMS.TreeEngine.TreeNode node = tp.SelectSingleNode(nodeId);
return AttachmentManager.GetPermanentDocUrl(nodeGUID, node.NodeAlias, CMSContext.CurrentSiteName);
}
}
}
return "2";
}
catch
{
return "1[" + nodeGuidParam +"]";
}
}