Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I like to use document type properties in user control.
And I like to detect the name (or type) of the document type hwo use the macro..
For exemple: I have document type named product having properties: ProductName and Price.
in my user control .NET I need to get all Name and Prices of product to do some calcul..
Do any one can help me!! any response can be useful for me :)
Thank you very much.
Hi,
There are a few ways of doing this, you can use the API http://our.umbraco.org/wiki/reference/api-cheatsheet
Or if you have uComponents installed you can use uQuery to grab specific data http://ucomponents.codeplex.com/wikipage?title=uQuery
Are you saying you need to get different values depending on the DocType? Not sure why you would only need unless a template was being used for more than one docTyp.
Rich
Not sure what you need exactly:
Document theDocument = new Document(docId); string contentType = theDocument.ContentType.Alias;
will tell you the documentType
DocumentType theDocuemntType = DocumentType.GetByAlias("documentType"); IEnumerable<Document> allNodesOfThisType = Document.GetDocumentsOfDocumentType(theDocuemntType.Id);
will get you a list of documents of a certain document type
I resolve the problem, thank you for your help.
I used for that umbraco.presentation.nodeFactory;
and instantiation of Node to get the current Node and All document type also.
Thank for help david and Rich. it's useful :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to get Document type propeties in a user control
Hello,
I like to use document type properties in user control.
And I like to detect the name (or type) of the document type hwo use the macro..
For exemple: I have document type named product having properties: ProductName and Price.
in my user control .NET I need to get all Name and Prices of product to do some calcul..
Do any one can help me!! any response can be useful for me :)
Thank you very much.
Hi,
There are a few ways of doing this, you can use the API http://our.umbraco.org/wiki/reference/api-cheatsheet
Or if you have uComponents installed you can use uQuery to grab specific data http://ucomponents.codeplex.com/wikipage?title=uQuery
Are you saying you need to get different values depending on the DocType? Not sure why you would only need unless a template was being used for more than one docTyp.
Rich
Not sure what you need exactly:
Document theDocument = new Document(docId);
string contentType = theDocument.ContentType.Alias;
will tell you the documentType
DocumentType theDocuemntType = DocumentType.GetByAlias("documentType");
IEnumerable<Document> allNodesOfThisType = Document.GetDocumentsOfDocumentType(theDocuemntType.Id);
will get you a list of documents of a certain document type
Hi,
I resolve the problem, thank you for your help.
I used for that umbraco.presentation.nodeFactory;
and instantiation of Node to get the current Node and All document type also.
Thank for help david and Rich. it's useful :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.