To show/hide inactive student in Gradebook:

-Open Course Gradebook.
-Click the down arrow next to the Settings icon (highlighted in yellow below)
-Select 'Display not Enrolled Students' (highlighted in green)
-Make changes then repeat the process by selecting 'Hide not Enrolled Students'