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

how to highlight a deselected row

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 15 May 2013, 01:53 PM
I am trying to find a way to highlight a row in a radgrid when it is deselected. I can get it to highlight when selected (via a checkbox), but I want to highlight it when that checkbox is unchecked (other than the default deselected row colors), this is so the users will know what they rows they have unchecked, before submitting form.

any ideas on how to do this?


1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 May 2013, 05:00 AM
Hi,

Please check the following script to give Background color for the Deselected row.

ASPX:
<ClientEvents OnRowDeselected="OnRowDeselected" />

Javascript:
<script type="text/javascript">
    function OnRowDeselected(sender, args)
    {
        var Grid = sender;
        var rowIndex = args._itemIndexHierarchical;
        var row = Grid.get_masterTableView().get_dataItems()[rowIndex];
        row.addCssClass("ClassB"); //setting css class for the row
    }
</script>

CSS:
<style type="text/css">
    .ClassB
    {
        background-color: Red;
    }
</style>

Thanks,
Princy.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or