Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » GetString and quotes not processed correctly in Razor template

GetString and quotes not processed correctly in Razor template

Lars Larsen
Lars Larsen
Reply

Hi

We have upgraded a solution from v9.6.9 to v9.13.6. Now when running a Razor template (a master.cshtml file) GetString and quotes does not get processed correctly. The first problem (first image) is that GetString() set in between sinlge quotes result in a compilation error. The second problem is that GetString() doesn't get processed correctly resulting in wrong values entered in the template. When Razor processes this code: 

<img src="@GetString("Item.Area.APK_Icon")" alt="APK icon" class="img-fluid">

the result is this:

<img src=""="" alt="APK icon" class="img-fluid">

And when adding a space after and before the first and last double quotes:

<img src=" @GetString("Item.Area.APK_Icon") " alt="APK icon" class="img-fluid">

the result is this:

<img src="/Files/Templates/Designs/TWG/%20@GetString(" item.area.apk_icon")="" alt="APK icon" class="img-fluid">

This you can see this in the second image

Screenshot_2022-05-20_095249.png Screenshot_2022-05-20_100238.png

Replies

 
Nicolai Pedersen
Reply

Hi Lars

In my memory that has never been possible. But the razor files are parsed and compiled by Microsoft MVC and Razor engine - both have been upgraded along the way.

You have to put the value into a variable and use that on the parameter.

Sorry about the inconvenience.

BR Nicolai

 

You must be logged in to post in the forum