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

RadGridView show selected row color when grid is disabled

1 Answer 192 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 17 Oct 2016, 08:24 PM

Hello,

I have an interesting theme issue with the grid. We have many screens where the grid is used to select the data you are working on and then we allow the users to edit fields for the records based on the grid selection.  The editing is done outside of the grid.

When the users are editing data we do not allow them to change the record they are on until they save the data. For this I flip the grid to the disabled state when editing begins, when they save or cancel the edit I then enable the grid.

I have my grid property for "UseDefaultDisabledPaint" to false, which does not grey out the entire grid and leaves it with our color selections.

The issue is the SelectedRow color is turned off. A single SelectedCell from the row is colored, but not the entire row. I need to have the entire row colored when the grid is disabled. I looked into the Visual Style Builder for this property and even in the ADD events I cannot select any property for the row when IsSelected or IsCurrent is true and IsDisabled is also true.

 

Is there a way to accomplish this with the theme or a way I can do it in code on the based grid? Read Only will not work as I need to not allow a selection of the grid. I was considering modifying the RowsChanging event to stop the users from changing rows, but I would have to also code for filtering, sorting and other events. Disabled would do the trick, I just need to get the entire row to remain colored. Can I do this in the theme or in code?

Thank you in advance,

Ben

 

I have attached two screen shots. Enabled and disabled samples.

I can also send our theme if you need it.

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Oct 2016, 11:05 AM
Hi Ben,

Thank you for writing.

There is no way to set the styles of only one row when the grid is disabled. However, there is no need to disable the entire grid in order to prevent the user from selecting another row. You can just create a flag and cancel the row changing operation: 
bool disableSelection = false;
private void RadGridView1_CurrentRowChanging(object sender, Telerik.WinControls.UI.CurrentRowChangingEventArgs e)
{
    if (disableSelection)
    {
        e.Cancel = true;
    }
}

In addition, I have removed the other thread. 

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
Themes and Visual Style Builder
Asked by
Ben
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or