Version

Styling negative text in WebCurrencyEditor

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

To style negative text in WebCurrencyEditor:

  1. Place a ScriptManager component and a WebCurrencyEditor 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 WebCurrencyEditor 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:

WebCurrencyEditor1.NegativeCssClass = "NegativeText"

In C#:

WebCurrencyEditor1.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:

images\WebCurencyEditor Styling negative text in WebCurrencyEditor 01.png