API Questions on Kentico API.
Version 6.x > API > Transformation/Data in custom web part View modes: 
User avatar
Member
Member
positivepurchasing - 7/13/2012 9:37:23 AM
   
Transformation/Data in custom web part
Hi

I've created a custom document type, created a few instances of it in cms desk and successfully displayed them on a page with using the document pager web part.

But I have no idea how to use the data in a custom web part. I have searched the documentation but found nothing. Is there some api call to retrieve data from a custom 'table'.

Please help as I am on the verge of giving up on Kentico as it is so difficult to use.

Cheers

User avatar
Member
Member
positivepurchasing - 7/13/2012 9:48:49 AM
   
RE:Transformation/Data in custom web part
Is this how???? - http://devnet.kentico.com/docs/5_5R2/devguide/index.html?selecting_nodes.htm

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/14/2012 12:09:03 PM
   
RE:Transformation/Data in custom web part
Hi,

yes, it is a way.

Or in case you will insert the web part to the layout and you would like to work with a current document, i.e.you can use class CMSContext to get data from selected document.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
positivepurchasing - 7/18/2012 6:30:45 AM
   
RE:Transformation/Data in custom web part
I'm lost, I've spent 3 days looking at the documentation and I have got no where.

I have created a document type and in the content tree created several instances of the document type.

What I want to do is get the list of documents in code so I can loop over them and display them in a web part.

How? Is there a provider class I can use?

Please help me!

User avatar
Member
Member
positivepurchasing - 7/18/2012 10:47:07 AM
   
RE:Transformation/Data in custom web part
I've done the following

TreeProvider treeProvider = new TreeProvider();

DataSet dataSet = treeProvider.SelectNodes(
CMSContext.CurrentSiteName,
ContentPath,
null,
true,
"custom.Test");

foreach (DataRow dataRow in dataSet.Tables["custom.Test"].Rows)
{
// do stuff
}


Which is obviously messy. Is there a nicer way to do this?

Basically all I'm asking is how do I retrieve data from the database?

Please Help!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/22/2012 5:32:39 PM
   
RE:Transformation/Data in custom web part
Hi,

actually, looping a data set is a correct way how to work with documents:
document API

But in case you just need to display these document you can use a repeater web part which displays documents according to your selection.

Best regards,
Ivana Tomanickova