Hi
In Database Value is +ve but i want to display as negative if Value is > 0
Thanks
Hi
In Database Value is +ve but i want to display as negative if Value is > 0
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Nov 1, 2022, 2:12 AM EDT
You can also use ternary as
0 ? "-"+Eval("Sold").ToString() : Eval("Sold").ToString() %>'>Aravind GovindarajRank #430 · 5.8K reputationPosted Oct 31, 2022, 12:16 PM EDT
try something like the below
if value >0 ? value * -1 : value;
Amit MohantyRank #112 · 20K reputationPosted Nov 1, 2022, 12:20 AM EDT
Try this
in your cs file
public string CheckNumber(object myValue) { if (long.Parse(myValue.ToString()) > 0) { return "-" + myValue.ToString(); } return myValue.ToString(); }in your aspx