ASPX templates
Version 3.x > ASPX templates > api help View modes: 
User avatar
Member
Member
nedb - 3/25/2008 6:42:37 PM
   
api help
Is it possible to access the current document's fields from the templates codebehind using the api?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/26/2008 2:31:04 PM
   
RE:api help
Hi,
yes, it is possible. Here you can find the API documentation - http://www.kentico.com/downloads/kenticocms_api.zip

Best Regards,
Juraj Ondrus

User avatar
Member
Member
nedb - 3/26/2008 3:39:08 PM
   
RE:api help
Could you provide a simple example?

Thanks!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/26/2008 3:43:30 PM
   
RE:api help
Hi again,
I am sorry I forgot to mention also our developer's guide - here you can find some examples how to manage the documents - http://www.kentico.com/docs/devguide/content_management_internals.htm

Best Regards,
Juraj Ondrus

User avatar
Member
Member
nedb - 3/26/2008 3:49:53 PM
   
RE:api help
Thanks I have reviewed that documentation. I'm confused on how to determine both the nodeId used in the SelectSingleNode example or the documentID in the SelectSingleDocumentID example.

Thanks

User avatar
Member
Member
nedb - 3/27/2008 3:20:21 AM
   
RE:api help
Ok I figured it out after extensive research in the forum.

//get doc id
int docid = CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentId;

//select the document
CMS.TreeEngine.TreeNode node = null;
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider();
node = tree.SelectSingleDocument(docid);

//access custom attribute

int myage = (int)node.GetValue("age");