Developer forum

Forum » Development » PAgeTemplateExtender : Empty loop

PAgeTemplateExtender : Empty loop

Gaetan Di Caro
Reply

Hello,

 

I'm trying to add a loop in the pagetemplateextender, but it doesn't seem to work.

Here is my code :

var productLoop = template.GetLoop("ImageBankProducts");
            
            foreach (var product in products)
            {
                productLoop.SetTag("ProductID", product.ProductID);
                productLoop.SetTag("ProductName", product.ProductName);
                productLoop.SetTag("ProductImageGUID", product.ImageGUID);
                productLoop.SetTag("ProductFilterIds", product.FilterIds);

                productLoop.CommitLoop();
            }

 

The loop is available in the page (I get the template tag), but it seems empty, even though if I log it shows that I iterate the foreach loop several times and that every tag I put has a value. I'm probably missing something very simple but I can't see it...

Do you have any idea ?

 

Thank you.

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hm, can I see the entire TemplateExtender?

 
Gaetan Di Caro
Reply

Ah, nevermind, I mistakenly left class="dwcontent" on the containing div of my loop in the template...

Thank you !

 

You must be logged in to post in the forum