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

New row background color of column

2 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Miguel Angel
Top achievements
Rank 1
Iron
Miguel Angel asked on 24 Aug 2017, 08:55 PM

Hi, Is there any way to change the background color in some specific column when the user does click on "Add new row" text.? I can change the color after the row was added but I don't know if its possible.

 

Something like this.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 25 Aug 2017, 05:05 AM
Hello Miguel,

You can use the ViewCellFormatting event to change the styles of the new row. Here is an example:
private void RadGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if (e.Row is GridViewNewRowInfo && e.ColumnIndex == 2)
    {
        e.CellElement.DrawFill = true;
        e.CellElement.BackColor = Color.Red;
        e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
 
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
 
}

Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Miguel Angel
Top achievements
Rank 1
Iron
answered on 28 Aug 2017, 02:59 PM
Works excelent. Thanks !
Tags
GridView
Asked by
Miguel Angel
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Miguel Angel
Top achievements
Rank 1
Iron
Share this question
or