Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • tarek 9 posts 30 karma points
    Apr 29, 2011 @ 11:15
    tarek
    0

    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.

  • Rich Green 2246 posts 4006 karma points
    Apr 29, 2011 @ 11:50
    Rich Green
    0

    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

  • david 46 posts 81 karma points
    Apr 29, 2011 @ 12:00
    david
    0

    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

     

  • tarek 9 posts 30 karma points
    Apr 29, 2011 @ 17:12
    tarek
    0

    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 :)

  • 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.

Please Sign in or register to post replies