Can a function have a gradient everywhere, but be non-continuous everywhere? It is well known that a function that has a gradient in $x$ is not necessarily differentiable in $x$ and may in fact be non-continuous in $x$ (unless the gradient is $C^1$.
 A: I'm assuming that by the term gradient, you mean the partial derivatives with respect to the basis elements.
So let's consider $f(x,y)= \frac{xy}{x^2+y^2}$ if $(x,y)\neq (0,0)$, and $f(0,0)=0$. Note that the partial derivatives $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ at (0,0) certainly exist, since $f(0,y)=0\ \forall y$ and $f(x,0)=0\ \forall x$. Hence, we have $\nabla f = (0,0)$ at $(0,0)$.
However, $f$ isn't continuous at $(0,0)$. We use the sequential definition of continuity, which says that if there is a sequence $(x_n)$ that converges to $(0,0)$, then the sequence $f(x_n)$ converges to $f(0,0)=0$.To see this, note that if we approach the point $(0,0)$ via the sequence $(\frac{1}{n},\frac{1}{n^2})$, then we get $f(x_n)=0.5\ \forall n$, but $f(0,0)=0 \neq 0.5$. Hence, f is not even continuous at $(0,0)$! This asks us to refine our definition of differentiability, and so we request for the continuity of the partial derivatives!
You want a function, that is nowhere continuous, but whose gradient exists everywhere. I tell you what, this is impossible.
In order to understand this, we must first understand that if the partial derivatives are continuous in even some small interval, then the function is differentiable, so continuous on that interval, so we would also like the partial derivatives to be discontinuous everywhere. This, however, is what is prohibited by what is called the Baire Category Theorem for functions.
If $f'$ existed at a point, then by a well-known theorem, it is a limit of a  pointwise converging sequence of continuous functions, which implies it is of a special class called Baire Class 1. It is known that functions of Baire class 1, are continuous on a dense set of $\mathbb{R}$, which is to say not only is the set of continuous points of $f'$ non-empty, it is in fact dense in $\mathbb{R}$. This proves that $f$ is infact differentiable on a dense set of $\mathbb{R}$, and hence $f$ can't even be nowhere-differentiable!
