RadGridView show selected row color when grid is disabled

2 posts, 0 answers
  1. Ben
    Ben avatar
    11 posts
    Member since:
    Dec 2015

    Posted 17 Oct 2016 Link to this post


    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,



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

    I can also send our theme if you need it.


  2. Dimitar
    Dimitar avatar
    2655 posts

    Posted 18 Oct 2016 Link to this post

    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.

    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.
Back to Top