You code looks OK and this is how you should check if the value is null. This is why I wanted to ask you if this code does not work on your side or perhaps something else is not working properly?
I am looking forward to your reply.
Regards,
Dimitar
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.