This is a migrated thread and some comments may be shown as answers.

Change color of selected row in gridview

1 Answer 873 Views
GridView
This is a migrated thread and some comments may be shown as answers.
DaveT
Top achievements
Rank 1
DaveT asked on 30 Jun 2010, 07:02 AM
Hello All,

Currently I am using a rad gridview and the themeName of the gridview is Control Default. When the user selects a row, it turns into orange color.

May I ask how do I change the color of the selected row to green? I have tried exploring the options when I click on "Edit UI Elements" of the gridview but I do not seem to find an option that allows me to do this.

Could anyone please advise me?

Thank you.

Dave Tan

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 01 Jul 2010, 04:56 PM
Hello DaveT,

You can change the visual appearance of the current row in two ways. You can use Visual Style Builder tool to customize the style of the current row. You can read more about the tool in this documentation article. Also you can subscribe for RowFormatting event, where you can change the desired row's properties. You can use the following code snippet as sample:

void radGridView_RowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement.RowInfo.IsCurrent)
    {
        e.RowElement.GradientStyle = GradientStyles.Solid;
        e.RowElement.BackColor = Color.Green;
    }
    else
    {
        e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        e.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
    }
}

You can read more about row formatting in this documentation article.

All the best,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
DaveT
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or