When you get a warning in your ASP.Net code, it means just what it says. The full error is usually:
“Function (YourFunction) doesn’t return a value on all code paths. A null reference exception could occur at run time when the result is used.”

Most often, this happens when you are using a Try/Catch block and returning the value of the function only inside your ‘try’ section. To remedy this, all you need to do is to remove it from the ‘try’ section, put it after the try/catch block. and, inside your ‘catch’ section put something like ‘return nothing’