Developer forum

Forum » Development » TemplateExtender: how to retrieve PageID an...

TemplateExtender: how to retrieve PageID an...


Reply
Hey guys,







Subject says it all;







I'm writing a custom ProductListTemplateExtender. Now i need the PageID and ParagraphID where the ProductList is rendered on.







Any ideas how to get these values ?







-Emil

Replies

 
Reply
nevermind, i found a workaround.
 
Reply

- Can you please post your workaround.


 


- What is the DynamicWeb suggestion to retrieve this ?


 


 


// Jeslas!

 
Reply


My workaround was to read the values of the existing Dynamicweb template tags.



I used the following code in a page template extender:



int iPageID = 0;

if (Template.Tags.getTagByName("DwPageID")!=null)

           if (ATemplate.Tags.getTagByName("DwPageID").Value.Length > 0)

                    iPageID = Convert.ToInt32( ATemplate.Tags.getTagByName("DwPageID").Value );








 
Reply

A better way wound be through the Pageview object.

Dynamicweb.Frontend.PageView pv = Dynamicweb.Frontend.PageView.Current();

int id = pv.Page.ID;

 

You must be logged in to post in the forum