# How to set the color of row？

**URL:** <https://forum.radzen.com/t/how-to-set-the-color-of-row/3520>\
**Category:** Blazor Server\
**Created:** [May 7, 2020, 1:20am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520 "2020-05-07T01:20:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![changfeng1800](https://forum.radzen.com/letter_avatar_proxy/v4/letter/c/7993a0/32.png) [@changfeng1800](https://forum.radzen.com/u/changfeng1800)\
**Post date:** [May 7, 2020, 1:20am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/1 "2020-05-07T01:20:50Z")

</div>

Hello,

1. I can set the cell color like this:  
void CellRender(CellRenderEventArgs args)  
{  
if (args.Column.Property == "Company")  
{  
args.Attributes.Add("style", $"background-color: {(true ? "#ff6d41" : "white")};");  
}  
}

2. but i can't set the row color like this:  
void RowRender(RowRenderEventArgs args)  
{  
args.Attributes.Add("style", $"background-color: {(true ? "#ff6d41" : "white")};");  
}

3. I want to set the row color by my self, how can i do that

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:** [May 7, 2020, 5:37am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/2 "2020-05-07T05:37:54Z")

</div>

You will need to set cell color to transparent if you want your row color to be visible.

---

<div class="post-metadata">

**Author:** ![pabis](https://forum.radzen.com/letter_avatar_proxy/v4/letter/p/8c91f0/32.png) [@pabis](https://forum.radzen.com/u/pabis)\
**Post date:** [October 2, 2020, 8:58am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/3 "2020-10-02T08:58:43Z")

</div>

I have Code which work well:

args.Attributes.Add("style", $"background-color: {(args.Data.DBMS\_DB\_Type=='B' ? "red" : "white")};");

but if I add Code like below:  
{  
If (args.Column.Property=='DBMS\_DB\_Type')  
{  
args.Attributes.Add("style", $"background-color: {(args.Data.DBMS\_DB\_Type=='B' ? "red" : "white")};");  
}  
}  
I have a compilation error:  
; expected

Where I forgot ';' - this sign

---

<div class="post-metadata">

**Author:** ![pabis](https://forum.radzen.com/letter_avatar_proxy/v4/letter/p/8c91f0/32.png) [@pabis](https://forum.radzen.com/u/pabis)\
**Post date:** [October 5, 2020, 5:28am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/4 "2020-10-05T05:28:41Z")

</div>

It work, but capital 'I' in condition 'If...' confused compilator

---

<div class="post-metadata">

**Author:** ![pabis](https://forum.radzen.com/letter_avatar_proxy/v4/letter/p/8c91f0/32.png) [@pabis](https://forum.radzen.com/u/pabis)\
**Post date:** [March 9, 2021, 9:35am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/5 "2021-03-09T09:35:01Z")

</div>

In new version of radzen 2.58 don't work error CS0019

---

<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:** [March 9, 2021, 9:49am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/6 "2021-03-09T09:49:38Z")

</div>

I am closing this thread as it doesn't meet the minimum quality requirements. There is no description of the problem, no code provided, no screenshot etc.

---

<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:** [March 9, 2021, 9:49am UTC](https://forum.radzen.com/t/how-to-set-the-color-of-row/3520/7 "2021-03-09T09:49:44Z")

</div>


