Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for NULL or 0 at the same time
Message
 
 
To
08/07/2008 21:49:29
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01329868
Message ID:
01329936
Views:
25
>>I have currently
>>  < %# (DataBinder.Eval(Container.DataItem, "SpouseID").ToString() != "")
>>? Eval("SpouseID", "<a href=\"javascript:void(0)\"
>>onClick=\"openPeopleID('{0}')\">Spouse's Information</a>") :
>>"<a href=\"javascript:void(0)\" onClick=\"openCreateID('motherName','AddressInfoRegular')\">
>>Enter Spouse's Info first</a>"% ></span>
>>
>>It works correctly if SpouseID is null, e.g. it goes to the Enter case. However, it doesn't work for the case it's a 0.
>>
>>Is there a simple check for both "0" and ""? Or how to implement null coalesce operator for this complex case?
>>
>>Thanks a lot in advance.
>
>Don't have a way to test this...
>
>But wouldn't it be:
((DataBinder.Eval(Container.DataItem, "SpouseID")??0) !=0)
No, it didn't work. I tried all possible combinations yesterday I could think of and was not able to make it.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform