I have a list of parts. All parts have PDF files on the server. Now, I want to create a list of links to these files based on data from the model. The file location is \Server\Files\Pdf. In the model, there is a field called HeadPart, which appears as "PART-332-223-122". I simply need to add ".pdf" at the end of the link.
I wanted to do it this way, but I got error CS1061:
<a href="\\Server\Files\Pdf\@item.HeadPart.pdf">@item.HeadPart</a>
Consider what the language parser is being told here:
You're looking for a property called
pdfon the propertyHeadPart(which is presumably a string). The error is telling you that no such property exists.You can explicitly wrap the server-side expression:
This tells the parser that specifically
item.HeadPartis Razor server-side code and the rest is client-side.