This is a migrated thread and some comments may be shown as answers.

Blank if Zero

1 Answer 64 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 27 Jul 2012, 03:23 PM
Is there a way to have the RadNumericUpDown to not display the value if it is 0? (or 0.0)

1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
answered on 27 Jul 2012, 05:39 PM
As is most often the case after banging one's head into the wall for a few hours and making no progress, then you humble yourself to ask for help... and suddenly the light bulb goes on!

I was trying to look for an answer working with the control, but with how it formats numbers for display I couldn't ride a wave for a solution.

so I stuck a crowbar into the control and extended it:
public class RRNumericUpDown :RadNumericUpDown
    {
        public override string FormatDisplay()
        {
            if (this.Value == 0.0d)
            {
                return "";
            }
            return base.FormatDisplay();
        }
 
    }

Hope this helps others looking for a similar solution.
Tags
NumericUpDown
Asked by
Joe
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 1
Share this question
or