So I'm trying to make a template that will allow my editors to upload something like a registration form that users can download. I am using the media picker to specify which file should be associated with the download link but I'm having trouble getting the url. I have this code in the Template:
var typedMediaPickerSingle = Model.Value<IPublishedContent>("registrationForm");
if (typedMediaPickerSingle != null)
{
<p>@typedMediaPickerSingle.Url</p>
<a href="@typedMediaPickerSingle.Url" >Registration Form</a>
}
but it errors out:
"CS0103: The name 'typedMediaPickerSingle' does not exist in the current context"
Trying to make a document download link
So I'm trying to make a template that will allow my editors to upload something like a registration form that users can download. I am using the media picker to specify which file should be associated with the download link but I'm having trouble getting the url. I have this code in the Template:
but it errors out: "CS0103: The name 'typedMediaPickerSingle' does not exist in the current context"
What am I doing wrong here?
Hi AsheM
It's just a guess but is your declaration of the variable outside of a code block?
does the above make a difference?
regards
Marc
It worked! Thank you I'm new to this and you totally fixed it!
is working on a reply...