I am about to make a website about beer brewing. On some of the beers I upload a recipe as PDF. How do i make a Razor script that only show the "Download recipe" button when a file / PDF is uploaded? The code below is what I need to show up when a file / PDF is uploaded:
Great! I am coming to Denmark on Tuesday for #CG13, will you be there?
Yes, it would be exactly the same way for a text string. If it was a media picker then it would be slightly different as you would need to lookup the Url from the media item.
I would really recommend you take a look at the examples in the documentation for the property editors here Compare TextString to Media Picker for example.
Thanks
Jeavon,
p.s. The other day you were using a Mvc Partial, today you are using a "classic" Razor macro, is there a reason for that?
Unfortunately not but I will be in Sweden canoeing with my kids. :-)
I will take a look at the examples.
To be honest I am fairly new to Umbraco and Razor and therefore I use some part of the code from examples like "CultivRazorexample" the Mvc part. And the classic Razor is something that i have learned from a friend. I am still learning a lot and my sites keeps changing from the last project to the next.
Ah cool, well I would say stick with the Mvc if you can. However, as you have probably found there are a lot more existing samples for "classic" razor macros. There are a load of useful Mvc docs here though.
I will definitely look at the Mvc docs and maybe use it even more in the future.
I really appreciate your help and I hope that you will have a nice trip to Denmark. At the moment the weather is just perfect and the forecast looks promising for next week.
Only show button if file is uploaded
Hi everybody
I am about to make a website about beer brewing. On some of the beers I upload a recipe as PDF. How do i make a Razor script that only show the "Download recipe" button when a file / PDF is uploaded?
The code below is what I need to show up when a file / PDF is uploaded:
Thanks in advance.
//René
Hi Rene,
What an awesome thing to be building a website about! Is your "recipe" property of type upload or is it something else?
If it is of type Upload then it would be like this:
Thanks,
Jeavon
Hi Jeavon,
You have just solved my problem again. :-) It worked perfectly.
If you ever swing by Denmark then give me a hint and I will fill up the fridge with some of my latest brew.
What if the property was something else than upload for example a textstring would that be made the same way?
// René
Hi René,
Great! I am coming to Denmark on Tuesday for #CG13, will you be there?
Yes, it would be exactly the same way for a text string. If it was a media picker then it would be slightly different as you would need to lookup the Url from the media item.
I would really recommend you take a look at the examples in the documentation for the property editors here Compare TextString to Media Picker for example.
Thanks
Jeavon,
p.s. The other day you were using a Mvc Partial, today you are using a "classic" Razor macro, is there a reason for that?
Hi Jeavon,
Unfortunately not but I will be in Sweden canoeing with my kids. :-)
I will take a look at the examples.
To be honest I am fairly new to Umbraco and Razor and therefore I use some part of the code from examples like "CultivRazorexample" the Mvc part. And the classic Razor is something that i have learned from a friend. I am still learning a lot and my sites keeps changing from the last project to the next.
// René,
Ah cool, well I would say stick with the Mvc if you can. However, as you have probably found there are a lot more existing samples for "classic" razor macros. There are a load of useful Mvc docs here though.
I will definitely look at the Mvc docs and maybe use it even more in the future.
I really appreciate your help and I hope that you will have a nice trip to Denmark. At the moment the weather is just perfect and the forecast looks promising for next week.
Thanks again!
// René,
is working on a reply...