Line colors are solid colors gradients cannot be assigned to them, that said coverting to 'line shape' the gradients can be assigned but it is NOT a line now but a shape that is governed by the line it was.
In your case duplicate your object convert to line shape apply your gradient fill then overlay on original object.
Jim