You are here: Skip Navigation Linksxnodesystems.com > Products > XField Suite > Multi-Select List Field

Multi-Select List Field - ASP.NET MultiSelect DropDownList with Validation

Do you ever need an ASP.NET MultiSelect DropDownList with validation? Multi-Select List Field is the answer. Multi-Select List Field respresents a labeled ASP.NET multi-select drop down list that allows user to select, display and validate multiple items from the autocomplete drop down list.

Implementation

Multi-Select List Field is implemented by the MultiSelectListField class.

Documentation

Click here to see the documentation of the MultiSelectListField class.

Validations

Multi-Select List Field supports validations in the following execution order.

  • Not null validation
  • Selected items count validation
  • Custom validation

Custom Validation

Multi-Select List Field supports custom validation at both client-side and server-side. To setup the custom validation error message, use the MultiSelectListField.CustomValidation.Message property; to setup client-side custom validation, use the MultiSelectListField.CustomValidation.ClientValidator property to specify the name of a JavaScript function that is used to perform client-side custom validation; to setup server-side custom validation, handle the server-side CustomValidate event.

The custom client validator function must take one parameter which in run-time will receve the validation context as a JSON object in the following format:

{"source":listBoxId, "data":selectedItems, "callback":callbackFunction}.

Here the "source" contains the id of the list box (multi-selectable select tag); "data" is an array that contains the selected option elements in the list box; "callback" contains a function that can be used during asynchronous custom validation to notify the XField's Client Validation Engine about the result of the validation.

To perform synchronous custom validation, add validation logic in the custom client validator you provide, and return a boolean value to indicate whether the field data passes the validation or not.

To perform asynchronous (Ajax) custom validation, first save the callback function somewhere (typically in a global variable); then setup Ajax call to the server-side to handle custom validation. After the Ajax call completes, notify the XField's Client Validation Engine about the result of the validation by invoking the saved callback with a boolean value to indicate whether the field data passes the validation or not.

Styles / Skin Management

Multi-Select List Field exposes the following properties to allow client to manage its styles or skin.

Property Name Property Type Default Value Description
DataControlsFontFamily System.String "" Gets or sets the font family for the data controls (e.g. "Arial").
DataControlsFontSize System.String "" Gets or sets the font size for the data controls (e.g. "12px").
HideSummary System.Boolean false Gets or sets a value indicating whether the selection summary should be hidden.
RemoveButtonText System.String "Remove" Gets or sets the remove button text.
SearchBoxWidth System.String "60px" Gets or sets the width of the search box (e.g. "60px").
SelectAllText System.String "Select All" Gets or sets the select all text.
SelectedItemsList SelectedItemsListStyles
  • SelectedItemsList.BackgroundColor = ""
  • SelectedItemsList.DisabledTextColor = "gray"
  • SelectedItemsList.ForeColor = ""
  • SelectedItemsList.Height = "94px"
  • SelectedItemsList.HighlightBackgroundColor = ""
  • SelectedItemsList.HighlightForeColor = ""
  • SelectedItemsList.MaxWidth = 300
Gets the settings that mangages the styles of the selected items list.
SelectionPromptText System.String "Select" Gets or sets the selection prompt text.
SuggestList SuggestListStyles
  • SuggestList.BackgroundColor = ""
  • SuggestList.BorderColor = ""
  • SuggestList.BorderWidth = ""
  • SuggestList.CloseButtonFontSize = "11pt"
  • SuggestList.ForeColor = ""
  • SuggestList.HighlightBackgroundColor = ""
  • SuggestList.HighlightForeColor = ""
  • SuggestList.MaxRows = 1000
  • SuggestList.MaxVisibleRows = 20
  • SuggestList.PageInfoKeyword = "/"
Gets the settings that mangages the styles of the suggest list.
SummaryPrefix System.String "" Gets or sets the prefix of the selection summary that indicates how many items are selected.
SummarySuffix System.String " selected" Gets or sets the suffix of the selection summary that indicates how many items are selected.


View Custom Validation Demo of Multi-Select List Field.

Go to top