I'm sure this is simple, I want to add values but only if the selected value is 1 I can't seem to get the expression correct.
@if (project.value1 == 1){project.value1+project.value3}
I get "Component attributes do not support complex content (mixed C# and markup). Attribute: 'Text'"
Is it possible also to do if/else?
Hi @kest874,
Could you elaborate? Where is this expression used? A screenshot from Radzen would help. Or some additional source code.
Plan to use it as the text value of a label, example:
l
I only want to add up the ratings that are "Safe" Label would show "5"
The value is "Safe" is always 1 I would need a nested if to add each one up if the "Safe" was chosen.
What component are you using? In general you cannot set a property of a Blazor component to an if statement. This is just how Blazor works. You can use a ternary operator though. Something like
${project.value1 == 1 ? project.value1 + project.value3 : project.value}
This worked: ${(project.value1 ==1?1:0)+(project.value2 ==1?1:0)+(project.value2 ==1?1:0)}
Thanks!