Developer forum

Forum » Development » Accessing template tag value from code

Accessing template tag value from code

Martin Nielsen
Reply
 Hi guys,

I'm creating a productlist extender where i need to access the total number of products in my list.
base.Productlist.Count gives me only the count for the current page (determined by pagesize), not the entire list of products.

Can i access the value from this tag <--@Ecom:ProductList.PageProdCnt--> inside my ProductListExtender? Or can I in some other way access the total number of products?

Regards
 Martin

Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi Martin,

You could try something like this:

int pageSize = Convert.ToInt32(Template.Tags.getTagByName("Ecom:ProductList.PageProdCnt").Value);


Not sure if it works but I successfully used this concept for other tags such as PageSize.

Cheers,

Imar
 
Martin Nielsen
Reply
 Hi Imar,

Thank you for the quick reply.
It works like a charm.

// Martin

 

You must be logged in to post in the forum