Skip to main content
Version: 4.2

TagTextBox

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

Represents a data field that displays a list of selectable and removable tags. The control recognizes tags as the user types and adds in front of the editable field.

public class TagTextBox : TextBoxBase

Derives from or implements TextBoxBase, IWisejControl.

  • TagCount Returns the number of tags in the control.
  • MaxTagCount Gets or sets the maximum number of tags allowed in the control. When this limit is reached, the control will fire the TagRejected event and will not add the tag. The default is 0 = unlimited.
  • MaxTagWidth Gets or sets the maximum width in pixels of the tag widgets displayed on the client. When the content exceeds this limit, it will show an ellipses.

Constructors​

Instance member TagTextBox()​

Initializes an instance of a TagTextBox control.

Properties​

Instance member AllowDuplicateTags 3.0.10+​

Boolean: Gets or sets whether duplicate tags are allowed. (Default: False)

When a duplicate tag is rejected, the control fires the TagRejected event.

Instance member Editable​

Boolean: Gets or sets whether the user can add tags by typing into the editable field. (Default: True)

Instance member KeepWatermark​

Boolean: Gets or sets whether the watermark should disappear when there is at least one tag. (Default: False)

Instance member MaxTagCount​

Int32: Gets or sets the maximum number of tags allowed in the control. When this limit is reached, the control will fire the TagRejected event and will not add the tag. The default is 0 = unlimited. (Default: 0)

Instance member MaxTagWidth​

Int32: Gets or sets the maximum width in pixels of the tag widgets displayed on the client. When the content exceeds this limit, it will show an ellipses. (Default: 100)

Instance member MinFieldLength​

Int32: Gets or sets the minimum number of characters that should fit in the editable portion of the control before it wraps to a new line or displays the scroller for the tags portion. (Default: 10)

Instance member SelectedText​

String: Returns the text of the selected tag.

Value: A string that represents the currently selected text in the text box.

Instance member SelectionLength​

Int32: Returns the length of the selected tag.

Value: The number of characters selected in the text box.

Instance member SelectionStart​

Int32: Returns the position of the selected tag.

Value: The starting position of text selected in the text box.

Instance member SeparatorChar​

Char: Gets or sets the character used to separate the tags. (Default: ,)

Instance member ShowToolTips​

Boolean: Gets or sets whether to show a tooltip with the full content of the tag text when the mouse hovers over the tag element. (Default: False)

Instance member TagCount​

Int32: Returns the number of tags in the control.

Methods​

Protected member OnAutoSizeChanged(e)​

Raises the AutoSizeChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnSeparatorCharChanged(e)​

Raises the SeparatorCharChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnTagAdded(e)​

Raises the TagAdded event.

ParameterTypeDescription
eTagTextBoxEventArgsA TagTextBoxEventArgs that contains the event data.

Protected member OnTagClick(e)​

Raises the TagClick event.

ParameterTypeDescription
eTagTextBoxMousEventArgsA TagTextBoxMousEventArgs that contains the event data.

Protected member OnTagDoubleClick(e)​

Raises the TagDoubleClick event.

ParameterTypeDescription
eTagTextBoxMousEventArgsA TagTextBoxMousEventArgs that contains the event data.

Protected member OnTagRejected(e)​

Raises the TagRejected event.

ParameterTypeDescription
eTagTextBoxEventArgsA TagTextBoxEventArgs that contains the event data.

Protected member OnTagRemoved(e)​

Raises the TagRemoved event.

ParameterTypeDescription
eTagTextBoxEventArgsA TagTextBoxEventArgs that contains the event data.

Protected member OnTagRender(e)​

Raises the TagRender event.

ParameterTypeDescription
eTagTextBoxRenderEventArgsA TagTextBoxRenderEventArgs that contains the event data.

Protected member OnTagSelected(e)​

Raises the TagSelected event.

ParameterTypeDescription
eTagTextBoxEventArgsA TagTextBoxEventArgs that contains the event data.

Protected member OnWebEvent(e)​

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)​

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Instance member SelectTag(tag)​

Selects the specified tag, if it exists. If the tag is selected successfully, it will fire the TagSelected event.

ParameterTypeDescription
tagStringText of the tag to select.

Events​

Instance member SeparatorCharChanged​

EventHandler Occurs when the value of SeparatorChar changes.

Instance member TagAdded​

TagTextBoxEventHandler Occurs when the user adds new tag is added to the control.

Instance member TagClick​

TagTextBoxMousEventHandler Occurs when the user clicks (or taps) on a tag outside of the close icon.

Instance member TagDoubleClick​

TagTextBoxMousEventHandler Occurs when the user double clicks (or double taps) on a tag outside of the close icon.

Instance member TagRejected​

TagTextBoxEventHandler Occurs when the user tries to add a tag that already exists or the maximum number of allowed tags set in MaxTagCount is reached.

Instance member TagRemoved​

TagTextBoxEventHandler Occurs when the user removes a tag from the control.

Instance member TagRender​

TagTextBoxRenderEventHandler Occurs when the control needs to render the tags in the Text property.

Use this event to change the visual aspect of each tag on the client.

private void tagTextBox1_TagRender(object sender, TagTextBoxRenderEventArgs e)
{
switch (e.Text)
{
case "Arizona":
e.BackColor = Color.Beige;
break;

case "Florida":
e.BackColor = Color.LightGreen;
break;

case "Alaska":
e.Html = "<b>" + e.Text + "</b>";
break;

case "California":
e.Html = "<u>" + e.Text + "</u>";
break;

case "Georgia":
e.Html = "<img src='Images/fullstar.png' style='display:inline-block;float:left;padding-right:5px' width='16'/>" + e.Text;
break;
}
}

Instance member TagSelected​

TagTextBoxEventHandler Fires when the user selects a tag.

Implements​

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
ILabelProvides access to the LabelWrapper associated with the controls that implement this interface.
IReadOnlyProvides access to the ReadOnly property for coontrols that support the read-only mode.
IModifiedProvides access to the Modified property and ModifiedChanged event for controls that implement this interface.
IValidationProvides access to the validation events and properties property for controls that support validation.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.