Developer forum

Forum » CMS - Standard features » ItemList tag bug

ItemList tag bug

Nuno Aguiar
Reply

Hi,

 

I think we ran into a bug with the Item list tag (http://templates.dynamicweb.com/TemplateTags/Dynamicweb-template-tags/Module-tags/Item-publisher/Item-Render.aspx)

 

When we apply a filter to the Item Publisher list, it seems the template engine is trying to parse the filter value. Through an integration process we got very large product ID numbers. Example: ProductID=88880091230 renders the error in attach

 

Here's what the code:


string str_productFilter = "Product=" + str_productID;
...
@RenderItemList(new {
      ItemType = "Reviews",
      ListSourceType = "NamedList",
      NamedListPageID = Convert.ToInt32(item["Reviews"].ToString()),
      TargetNamedList = "Reviews",
      ItemFieldsList = "*",
      ListTemplate = "ItemPublisher/List/productReviewsList.cshtml",
      ListPageSize = 999,
      ListOrderBy = "Product",
      Filter = @str_productFilter
    })

 

Now, it the productNumber where to be a string, there was no problem. If the tag was parsed as a string, despite being a number, there wouldn't be an issue.

 

Best Regards,

Nuno Aguiar

ClockBlowing.jpg

Replies

 
Nuno Aguiar
Reply

Anyone? Bump.

 
Scott Forsyth
Reply
This post has been marked as an answer

Hi Nuno,

If you force the value to a string then it won't try to convert to an Int32. You can do that by putting quotes around the ProductID's value:

string str_productFilter = "Product=\"" + str_productID + "\"";

Votes for this answer: 1
 
Nuno Aguiar
Reply

Hi Scott,

 

That worked. But Dynamicweb should pick it up automatically and not throw an error. Can anyone at DW acknowledge it?

 

Nuno Aguiar

 
Scott Forsyth
Reply

Hi Nuno,

The solution if Dynamicweb provides a fix is to either assume that they are strings, or it should determine the field type of the database column or filter object and use that instead. Currently it assumes that it's an Int32 if it's not surrounded in quotes.

 
Nuno Aguiar
Reply

Yep, I agree

 

You must be logged in to post in the forum