Version

Styling negative text in WebNumericEditor

WebNumericEditor™ allows you to style negative numeric values by simply setting the control’s NegativeCssClass property. This will make negative values in the WebNumericEditor control apparent.

To style negative text in WebNumericEditor:

  1. Place a ScriptManager component and a WebNumericEditor control on the WebForm.

  2. Include the following code in your ASPX source to define the negative text CSS class;Once this CSS class is associated to the WebNumericEditor control, the text will change to the color red as soon as a negative value is typed into the control.

In HTML:

<style type="text/css">
     .NegativeText
     {
        color : Red;
     }
    </style>
  1. Set the NegativeCssClass property either using the Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

WebNumericEditor1.NegativeCssClass = "NegativeText"

In C#:

WebNumericEditor1.NegativeCssClass = "NegativeText";
  1. Save and run your application. Type a negative value in the editor and as soon as the control loses focus you will observe that the CSS class gets applied to the editor similar to the following image:

WebNumericEditor Styling negative text in WebNumericEditor 01.png