sitecore7 - Sitecore Building a single page from child node data -


i have sitecore structure of items comprises of

  • range
    • product 1
      • product name (text)
      • product image (image)
    • product 2
      • product name (text)
      • product image (text)

i need make single page view iterates through each of these nodes , collects , outputs data each - can assist in method best use this?

sorry if basic question example code appreciated.

you should think using single product template product name field , product image field instead of having items single fields under product. if requirement, how it.

sublayout (or layout if need be)

<div>     <sc:text runat="server" id="txtproductname" field="productname"/>     <sc:image runat="server" id="imgproductimage" field="productimage"/> </div> 

then in code behind take current item (the product , find child item corresponds looking , assign field item.

    private void page_load(object sender, eventargs e)     {         if (!ispostback)         {             binddata();         }     }      private void binddata()     {         txtproductname.item = sitecore.context.item.children.firstordefault(x => x.templateid == constants.templates.productname);         imgproductimage.item = sitecore.context.item.children.firstordefault(x => x.templateid == constants.templates.productimage);     } 

in example resolving looking item of template type x, go name or other way of knowing.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -