I want to format a 10digit number display like so:
Phone: (###) ###-####
I had a little asp.net snippet that worked great for this,
string.Format("{0:Phone: (###) ###-####}", Int64.Parse(Eval("OfficePhone").ToString()))
But "string.Format" is nonsense to XML transformation type. Any suggestions?
{% GetDocumentUrl(); %} // text/xml
Is not the same as
<%# GetDocumentUrl() %> // ascx or std c#
So if you'd wrap your code in <%# %> you'd be set.
<%# %>
<%# string.Format("{0:Phone: (###) ###-####}", Int64.Parse(Eval("OfficePhone").ToString())) %>
While you specified you created an asp.net snippet, that will not work in a text/xml transformation as you've found. Check out the Macro Methods documentation, should get you going in the right direction. Or just use ascx transformation, no reason not to.
{% GetDocumentUrl(); %} would write "{% GetDocumentUrl(); %}" to my pages while using ascx. That's why I switched to text/xml transformation. Yes I have read the Macro Methods documentation.
Ahh, it was such a simple solution. Thank you Brenden.
Please, sign in to be able to submit a new answer.