# Datagrid template

**URL:** <https://forum.radzen.com/t/datagrid-template/3192>\
**Category:** Angular\
**Created:** [April 8, 2020, 9:30am UTC](https://forum.radzen.com/t/datagrid-template/3192 "2020-04-08T09:30:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![markb](https://forum.radzen.com/letter_avatar_proxy/v4/letter/m/a8b319/32.png) [@markb](https://forum.radzen.com/u/markb)\
**Post date:** [April 8, 2020, 9:30am UTC](https://forum.radzen.com/t/datagrid-template/3192/1 "2020-04-08T09:30:29Z")

</div>

Hi,

I have a database table with records which have a field (NoteDisplayColour) which contains a Hex colour code. This is shown in the DataGrid component. Is it possible to change the colour (background or text) of the column showing the colour code to actually display using the colour in the Hex field?

I've tried using this template but, it doesn't seem to like using expressions within inline styles:

```
<span style="color: ${data.NoteDisplayColour};">
    ${data.NoteDisplayColour}
</span>
```

---

<div class="post-metadata">

**Author:** ![markb](https://forum.radzen.com/letter_avatar_proxy/v4/letter/m/a8b319/32.png) [@markb](https://forum.radzen.com/u/markb)\
**Post date:** [April 8, 2020, 9:38am UTC](https://forum.radzen.com/t/datagrid-template/3192/2 "2020-04-08T09:38:29Z")

</div>

I've sorted this one myself...Angular Dynamic binding seems to work:

 ![image](https://forum.radzen.com/uploads/default/original/2X/a/a95c6db3437fa84c595a3e0bdc137e14fee850ce.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [April 8, 2020, 11:22am UTC](https://forum.radzen.com/t/datagrid-template/3192/3 "2020-04-08T11:22:25Z")

</div>

Just a small correction - the Angular syntax should be:

```auto
<span [style.color]="data.NoteDisplayColour">
</span>

```

Didn't know that "this.data.NoteDisplayColour" would work.

---

<div class="post-metadata">

**Author:** ![markb](https://forum.radzen.com/letter_avatar_proxy/v4/letter/m/a8b319/32.png) [@markb](https://forum.radzen.com/u/markb)\
**Post date:** [April 8, 2020, 1:11pm UTC](https://forum.radzen.com/t/datagrid-template/3192/4 "2020-04-08T13:11:07Z")

</div>

Thanks for the correction 🙂

---

<div class="post-metadata">

**Author:** ![Dominic\_Lallemant](https://forum.radzen.com/user_avatar/forum.radzen.com/dominic_lallemant/32/1058_2.png) [@Dominic\_Lallemant](https://forum.radzen.com/u/Dominic_Lallemant)\
**Post date:** [February 3, 2022, 5:52am UTC](https://forum.radzen.com/t/datagrid-template/3192/5 "2022-02-03T05:52:51Z")

</div>

Can you please show me where you would put this angular syntax. Many thanks

---

<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:** [February 3, 2022, 5:59am UTC](https://forum.radzen.com/t/datagrid-template/3192/6 "2022-02-03T05:59:32Z")

</div>

This code can be used as column template.

---

<div class="post-metadata">

**Author:** ![Dominic\_Lallemant](https://forum.radzen.com/user_avatar/forum.radzen.com/dominic_lallemant/32/1058_2.png) [@Dominic\_Lallemant](https://forum.radzen.com/u/Dominic_Lallemant)\
**Post date:** [February 4, 2022, 3:55am UTC](https://forum.radzen.com/t/datagrid-template/3192/7 "2022-02-04T03:55:24Z")

</div>

I am already using the column template with the following code, is there a way to combine the background colour as well?

```auto
<p style="white-space:pre-wrap">${data.JobNo}</p>

```

 ![image](https://forum.radzen.com/uploads/default/original/2X/e/eb95d276bc0169c4d3f9f0d5ea235aa21b70dbf0.png)

---

<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:** [February 4, 2022, 5:31am UTC](https://forum.radzen.com/t/datagrid-template/3192/8 "2022-02-04T05:31:36Z")

</div>

Yes, you can add binding for the backgroundColor similar to the example in this thread.
