Developer forum

Forum » CMS - Standard features » Item type filtering- Cannot select Id on an Item Type

Item type filtering- Cannot select Id on an Item Type

Kevin O''Driscoll
Reply

I have a few questions regaring the use of Item types and Razor templates.

We are using DW v8.3.1.18 and do not want to upgrade to 8.4 until it is deemed a stable version

We Have an Item Type for Category. We select from a checkbox list the 
categories on each Item Type Product (multiple categories for each product)
We wish now to filter for products in each category.

I have two versions of this product Item Type, 
V1  we set the checkbox values with the dropdown select on Category_Name 
this is the current DW way.
V2  we set the Category_Id as the value for the checkboxes, this is done by 
manually changing the MetaData for this control (Id selection is not 
allowed)

V2 took me 20 mins to write a Razor Template to complete the desired 
filtering and its accurate based on the Id.

V1 still cannot be completed. Since there is a problem in DW Razor implementation 

- we cannot use System.Web.HttpUtility.HtmlEncode("txt");
or the accepted Razor implementation - @Html.Encode("txt");

There seems to be no implementation for encode/decode html in DW Razor so 
our URLs do not get mangled, since in V1 we are filtering on the Category_Name. This is a major flaw (unless Im missing 
something?)

Also - Why can we not debug Razor Templates in VS when running in dev? /Files 
folder is a virtual directory and a web site not a web application but 
should run in the shared AppPool
I have managed to debug the c# code in a seperate class library project in 
the main solution and then copy the code back into the template, 
but still looses the DW Templating API and then requires a lot of 
guesswork tweeking afterwards.

Other experiences - Images stored on Item Types get forgotten by the Item Type (ie the 
image links gets deleted from the database when the Item type on the 
paragraph is re-opened)
The file is set to a Base directory other than the default /Files ( like 
/Files/Schools) and extensions are restricted .jpg,.png,.gif
When the defaults are reset we see the images not being deleted.

I have also seen some paragraphs forgetting that an Item type is 
attached (Ive had to update the Paragraphs table manually in the db to 
re-implement these)

Do you have any solutions for these problems?


Replies

 
Mikkel Ricky
Reply

You should really consider upgrading to Dynamicweb 8.4 as it may resolve a number of the issues you have. Dynamicweb 8.4 is not yet deemed "Stable" (as per the criteria for being this), but it is "Project ready", i.e. it has been used on several solution in production and most bug have been found and fixed in the 19 hotfixes that we've made.

And now, back on the Razor track: I have succesfully used the methods on System.Web.HttpUtility in Razor templates. Which issues do you run into when trying (parse errors, runtime errors, …)?

Dynamicweb is using RazorEngine to process Razor templates and currently it doesn't support debugging directly in Visual Studio. However, some work has been done to make it work (see https://github.com/Antaris/RazorEngine/pull/131/) and I will take at look to see if we can add this to Dynamicweb Razor templates.

We have fixed a couple of item related bugs as you describe, but if you still experience errors we need to take a closer look at it. If you can reproduce these errors then you should use our support system to report them as bugs. An upgrade to our project ready version 8.4 may resolve the issues as a lot of work has been put into items.

Best regards,
Mikkel

 

You must be logged in to post in the forum