Skip to main content

ejAutocomplete

Namespace: Wisej.Web.Ext.Syncfusion

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

The Autocomplete control for JavaScript is a textbox control that provides a list of suggestions based on the user query.

public class ejAutocomplete : ejBase

When the user enters a text in the text box, the control performs the search operation and provides a list of results in the suggestion pop up. There are several filter types available to perform the search.

See demo at: https://js.syncfusion.com/demos/web/

Constructors​

Instance member ejAutocomplete()​

Constructs a new instance of the ejAutocomplete class.

Example:

The following example creates the control and sets the list of suggestions through the options.

var autocomplete = new ejAutocomplete();
autocomplete.Options.dataSource = new[] { "Austria", "Belgium", "Brazil", "Canada" };
autocomplete.Options.watermarkText = "Select a country";
autocomplete.Location = new Point(20, 20);
this.Controls.Add(autocomplete);

Instance member ejAutocomplete(options)​

Constructs a new instance of the ejAutocomplete class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example binds the suggestions to a list of objects and searches the typed text anywhere in the name.

var autocomplete = new ejAutocomplete(new
{
dataSource = customers,
fields = new { text = "CompanyName", key = "CustomerID" },
filterType = "contains",
watermarkText = "Search a customer"
});
this.Controls.Add(autocomplete);

Properties​

Instance member Text​

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

The property reads and writes the value option of the widget and raises the TextChanged event every time it is assigned. It is not updated when the user changes the text in the browser: handle the change or select event of the widget to receive the value entered by the user.

Example:

// set the text shown in the widget.
this.autocomplete1.Text = "Canada";

// receive the text entered or selected by the user.
this.autocomplete1.Instance.onChange += new WidgetEventHandler((s, e) =>
{
string value = e.Data.value;
AlertBox.Show(value);
});

Implements​