Skip to main content

ejPercentageTextbox

Namespace: Wisej.Web.Ext.Syncfusion

Assembly: Wisej.Web.Ext.Syncfusion (4.1.0.0)

PercentageTextBox is used to display only percentage values. It has Spin buttons to increase or decrease the values in the Text Box.

public class ejPercentageTextbox : ejBase

Constructors​

Instance member ejPercentageTextbox()​

Constructs a new instance of the ejPercentageTextbox class.

Example:

The following example creates the percentage text box and sets the value and the range through the options.

var percentage = new ejPercentageTextbox();
percentage.Options.value = 20;
percentage.Options.minValue = 0;
percentage.Options.maxValue = 100;
percentage.Location = new Point(20, 20);
this.Controls.Add(percentage);

Instance member ejPercentageTextbox(options)​

Constructs a new instance of the ejPercentageTextbox class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a percentage text box with one decimal place that changes by 5 at each step.

var percentage = new ejPercentageTextbox(new
{
value = 12.5,
decimalPlaces = 1,
incrementStep = 5,
minValue = 0,
maxValue = 100
});
this.Controls.Add(percentage);

Properties​

Instance member Text​

String: Gets or sets the text for the ejPercentageTextbox. (Default: "")

The property reads and writes the value option of the widget and raises the TextChanged event every time it is assigned. The getter returns null when the option is not set. The setter compares the new text with the current value option: set the option, either in the constructor or through Options, before assigning this property, and do not assign null.

The property is not updated when the user changes the number in the browser: handle the change event of the widget to receive the value entered by the user.

Example:

// the value option must be set before using the Text property.
var percentage = new ejPercentageTextbox(new { value = 20 });
percentage.Text = "35";

// receive the value entered by the user.
percentage.Instance.onChange += new WidgetEventHandler((s, e) =>
{
AlertBox.Show($"Value: {e.Data.value}");
});

Implements​