I have the following code that works well until you move away from the page that holds the values (Home). I've converted the values to be recursive but am struggling to get the @Model.HasValue part to work:
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
if (@Model.showDonationBox == true)
{
double donationCurrent;
donationCurrent = @Model.HasValue("_donationCurrent") ? @Model._donationCurrent : 1;
double donationTarget = @Model._donationTarget;
double progress = Math.Round((donationCurrent / donationTarget) * 100.00, 0);
var progressWidth = @progress + "%;";
<div class="widget">
<h4 class="headng backcolr">@Model._donationTitle</h4>
<div class="donation">
<p>@Model._donationText</p>
<!-- Need to convert this If statement to look up the tree to find the donationCurrent value, and if not found then not show the progressContainer -->
@if (@Model.HasValue("donationCurrent"))
{
<div id="progressContainer">
<div id="progress_bar" class="ui-progress-bar ui-container">
<div class="ui-progress" style="width: @progressWidth">
<span class="ui-label" style="display:none;">Processing <b class="value">79%</b></span>
</div><!-- .ui-progress -->
</div><!-- #progress_bar -->
</div>
}
<div class="collection">
<h2 class="colr bold">£@Model._donationCurrent</h2>
<h4 class="target bold">Target: £@Model._donationTarget</h4>
</div>
<h2 class="bold backcolr donbtn">
<a href="#">Donate Now</a></h2>
</div>
</div>
}
}
Obviously @Model.HasValue("donationCurrent") works if your on the homepage where the value is stored, but if you move further down the tree, then it stops working.
I've also been misreading the _propertyAlias (recursive) element on the cheat sheet (stupid brain). Even though I've been able to get OTHER things to work correctly.
@Model.HasValue recursive ?
I have the following code that works well until you move away from the page that holds the values (Home). I've converted the values to be recursive but am struggling to get the @Model.HasValue part to work:
Obviously @Model.HasValue("donationCurrent") works if your on the homepage where the value is stored, but if you move further down the tree, then it stops working.
Doh !! Try Googling a little longer !!
@Model.HasValue("donationCurrent",true)
Thanks for the direction!
I've also been misreading the _propertyAlias (recursive) element on the cheat sheet (stupid brain). Even though I've been able to get OTHER things to work correctly.
Has this changed in 8?
doing
returns this error: CS1503: Argument 3: cannot convert from 'bool' to 'string'
is working on a reply...