You are not doing what you are expecting with this string:
"/@Model.Content.GetPropertyValue("placeID")"
Since you are inside of a string in a C# code block, that @Model has no special meaning (i.e., it literally gets interpreted that way, rather than getting evaluated as an expression). You want something like this (I haven't tested this in Visual Studio, so it may have typos):
Also, you might consider calling GetPropertyValue<string>("placeID") (assuming that field is a string).
If you store that generated folder path into a variable, you can use the debugger in Visual Studio to set a breakpoint and inspect the value to ensure it is correct.
Pick up directory folder dynamically
Hello, I need to replace the hardcoded folder name with that set by specific docType Property Value, here's my partial view page code,
And I have tried the following but I think that it's missing something,
Thank you,
You are not doing what you are expecting with this string:
Since you are inside of a string in a C# code block, that
@Model
has no special meaning (i.e., it literally gets interpreted that way, rather than getting evaluated as an expression). You want something like this (I haven't tested this in Visual Studio, so it may have typos):Also, you might consider calling
GetPropertyValue<string>("placeID")
(assuming that field is a string).If you store that generated folder path into a variable, you can use the debugger in Visual Studio to set a breakpoint and inspect the value to ensure it is correct.
Awesome! Thank you very much Nicholas!
And here's the final code, works without
<string>
is working on a reply...