ASPX templates
Version 4.x > ASPX templates > Using a Document Selector - Turn GUID into Document or Document URL/Document Link View modes: 
User avatar
Member
Member
byron-falcon-software - 8/13/2009 11:00:14 AM
   
Using a Document Selector - Turn GUID into Document or Document URL/Document Link
We have a custom data type that uses a Document Selector as a field so that the client can select the location of a More Info type of link.

This field returns the GUID of the Document but I can't for the life of find the way to load the document with a GUID as no TreeHelper function does it or CMSContent.GetDocumentURL uses a standard document id as an integer.

Utlimately, this needs to be a link on the page to the alias for the documents, a friendly URL, so that their SEO isn't screwed up with some GUID or alias path on a query string type of scenario.

Maybe there is a better way to do that with a different field type for our custom type, but for now, answering how to load a document with a GUID is probably also going to help on other things.

I actually assumed when I first started Kentico when I saw the GUID of the Nodes that everything would be GUID in the API, especially the getting of documents, and I am actually very disappointed that it isn't.

It would save a lot of headache to just go fully GUID depenedent for current and versions of documents, like Documentum, or at least have GUID version of the GetSingleNode or something tanglible like that.

User avatar
Member
Member
byron-falcon-software - 8/13/2009 11:08:37 AM
   
RE:Using a Document Selector - Turn GUID into Document or Document URL/Document Link
This answers my own question, but it begs another question. Why are the document selection functions but type separated and not part of the same TreeHelper, (Maybe call it DocumentSelector), helper class?

http://devnet.kentico.com/Forums.aspx?forumid=41&threadid=9376

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/14/2009 3:33:10 AM
   
RE:Using a Document Selector - Turn GUID into Document or Document URL/Document Link
Hi,

Could you please consider using this API to achieve your need. It is about custom function for transformation, but the code could inspire you how to get the URL of the document when you know the guid. Please see this article.

I hope it will help.

Best Regards,
Juraj Ondrus