Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to check Null value in textbox field,if it 's Null,then print something.I tried Is Nothing but still getting the #ERROR display.

=IIF(Fields!NonTechHours.Value is Nothing,"Null",IIF(Right(Fields!NonTechHours.Value,InStr(Fields!NonTechHours.Value,"."))>0,Fields!NonTechHours.Value,Left(Fields!NonTechHours.Value,InStr(Fields!NonTechHours.Value,".")-1)))
Posted
Comments
Sandeep Mewara 16-Feb-11 5:56am    
I see you do a repost, why so? Please avoid it in future!

If you are using .Net 2.0 or above, you can actually use the null coalesce operator - ??.

This will convert null into "" automatically.
Your code will be something like Fields!NonTechHours.Value?? "".
 
Share this answer
 
Comments
Rajni from delhi 16-Feb-11 0:27am    
?? operator is not in RDLC
Abhinav S 16-Feb-11 0:56am    
I thought you were writing this line in code as your question tag said C#.
Sergey Alexandrovich Kryukov 16-Feb-11 0:57am    
I voted 5 before I was this note -- won't hurt I hope :-)
--SA
Abhinav S 16-Feb-11 1:35am    
No it wont hurt at all. :)
Sergey Alexandrovich Kryukov 16-Feb-11 0:56am    
What your tag C# means? It is applicable? If not, remove it, don't confuse people!
--SA
The text property of the textbox class is a string. It wont even accept System.DBNull.Value as a value. If you set it equal to some other object, it will be cast as string.

Based on this,TextBox1.Text = "" is just as viable as anything else.
 
Share this answer
 
Comments
Rajni from delhi 16-Feb-11 0:35am    
Not Getting.wht should i do to achieve this ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900