# Tertiary conditional used in template?

**URL:** <https://forum.radzen.com/t/tertiary-conditional-used-in-template/9554>\
**Category:** Radzen.Blazor Components\
**Created:** [December 1, 2021, 8:31pm UTC](https://forum.radzen.com/t/tertiary-conditional-used-in-template/9554 "2021-12-01T20:31:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![terryfryar](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/a698b9/32.png) [@terryfryar](https://forum.radzen.com/u/terryfryar)\
**Post date:** [December 1, 2021, 8:31pm UTC](https://forum.radzen.com/t/tertiary-conditional-used-in-template/9554/1 "2021-12-01T20:31:43Z")

</div>

Can a C# tertiary conditional statement be used in a template? I tried, but get errors in the component design display...but it works at runtime. Something like this:

```auto
<Template Context="data">
@((data.sensorType >= 0) && (data.sensorType < sensorTypes.Count) ? sensorTypes[data.sensorType].desc : "")                  
</Template>

```

If I change this to use "if else" it works at both designtime and runtime.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [December 2, 2021, 7:33am UTC](https://forum.radzen.com/t/tertiary-conditional-used-in-template/9554/2 "2021-12-02T07:33:00Z")

</div>

Not sure in which component template is this, can you clarify? I've tried DataGrid column template the following and it worked:

 ![image](https://forum.radzen.com/uploads/default/original/2X/c/c236caf626cc72d7160304d568dbbc5914043cbb.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/b/b709b6c76f49ded2571680bd0be772e7305e686f.png)

The application I tested in Blazor server, .NET6.

Your post is in Blazor Components category however most probably should be in Radzen Blazor server/WebAssembly

---

<div class="post-metadata">

**Author:** ![terryfryar](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/a698b9/32.png) [@terryfryar](https://forum.radzen.com/u/terryfryar)\
**Post date:** [December 2, 2021, 3:16pm UTC](https://forum.radzen.com/t/tertiary-conditional-used-in-template/9554/3 "2021-12-02T15:16:13Z")

</div>

Well, I tried it again and it works? I guess I had a bit of syntax off maybe?
