vendredi 22 novembre 2019

How to check two condition with aspx inline code

I am getting a value from database with using Eval("price"), i am checking if price is empty or null but i would like to check if price is equal to the zero or bigger than zero condition at the same time.

I am checking IsNullOrEmpty with this code:

<%# String.IsNullOrEmpty(Eval("price").ToString()) ? "Not Available" : Eval("price").ToString() %>

I would like to check if(price = 0) say free or else if(price > 0) than show price condition at the same time and show message.

<%# Eval("price").ToString() == "0" ? "FREE" : Eval("price").ToString() %> // Not working

Is it possible to check isnullorempty and price in same inline code?

Aucun commentaire:

Enregistrer un commentaire