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

Client side client event for sorting columns?

1 Answer 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lauren
Top achievements
Rank 1
Lauren asked on 04 Nov 2011, 07:27 PM
Hello,

Our team noticed that when Sorting is enabled on the RadGrid, the user can click the column header to sort the table but focus does not stay on that link. This is an accessibility issue because the page focus goes back to the top of the page after the grid is sorted and a keyboard user would have to tab all the way back down to the grid. We were wondering, is there a client-side event that we could call when the sortable column is clicked on the RadGrid? We could then call a custom JavaScript method to set focus to that link.

Thank you,

Lauren Jones

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Nov 2011, 06:49 AM
Hello,

void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.SortCommandName)
       {
           Page.ClientScript.RegisterStartupScript(this.GetType(), "testSort", "excuteAfterSortCommand();", true);
               // or
           ScriptManager.RegisterStartupScript(this, this.GetType(), "testSort", "excuteAfterSortCommand();", true);
       }
   }

<script type="text/javascript">
 
        function excuteAfterSortCommand() {
            alert('set focus');
        }
    </script>


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Lauren
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or