pls help me to find the nodeId

ramesh perera asked on January 22, 2015 13:50

I have "skuNumber". using this "skuNumber" how can i get the "nodeId" within the "cmsTransformation" class

Thanks Ramesh

Recent Answers


Dawid Jachnik answered on January 22, 2015 15:50 (last edited on January 22, 2015 15:52)

Hi, try something like this:

<%#GetNodeIDBySKUNumber(Eval("SKUNumber")) %>

<script type="text/c#" runat="server">
private int GetNodeIDBySKUNumber(object skunumber)
{
   var doc = CMS.DocumentEngine.DocumentHelper.GetDocuments("product.classname").OnCurrentSite().TopN(1).Columns("NodeID").WhereEquals("SKUNumber", ValidationHelper.GetString(skunumber, "")).FirstObject;
    if (doc != null)
    {
        return doc.NodeID;
    }
    return 0;
}

6 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.