Smith Stanley
Smith Stanley

Reputation: 481

JQuery To Change TeleRik RadGrid Row Color

I am attempting to use this to change the row color to white

row.cells[1].css('background-color', '#B3B3B3');

I get an error of

Uncaught TypeError: row.cells[1].css is not a function

What is the appropriate way to achieve this restult?

Upvotes: 0

Views: 689

Answers (1)

VDWWD
VDWWD

Reputation: 35514

Use Attributes if you want to change the color from code behind.

row.cells[1].Attributes.Add("style", "background-color: #B3B3B3");

Or assign a class

row.Cells[1].CssClass = "myClass";

<style>
    .myClass {
        background-color: #B3B3B3
    }
</style>

UPDATE

So if you want it on a button click, do it like this

protected void Button1_Click(object sender, EventArgs e)
{
    GridView1.Rows[1].Cells[1].CssClass = "myClass";
}

Upvotes: 1

Related Questions