Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check for NULL or 0 at the same time
Message
De
08/07/2008 21:49:29
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01329868
Message ID:
01329889
Vues:
14
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform