Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

CascadingDropDown

MikhailTymchukDX edited this page Jan 12, 2018 · 5 revisions

Demo Page

CascadingDropDown is an ASP.NET AJAX extender that can be attached to an ASP.NET DropDownList control to get automatic population of a set of DropDownList controls. Each time selection of one DropDownList control changes, CascadingDropDown makes a call to a specified web service to retrieve the list of values for the next DropDownList in the set.

Properties

Name Description
Category A category of this DropDownList (used when communicating with the helper web service).
ClearSelectedItemOnParentChange Always clear selected item when parent value changes.
ContextKey User/page specific context provided to an optional overload of the web method described by ServiceMethod/ServicePath. If the context key is used, it should have the same signature with an additional parameter named contextKey of the sting type.
EmptyText Optional text for an option displayed when the list is empty.
EmptyValue An optional value for an option displayed when the list is empty.
EnableAtLoading Determines wether or not to disable the DropDownList control when it is waiting for data from the service, so on loading a user can use the keyboard to navigate to the drop-down control.
LoadingText Optional text displayed by DropDownList when it is loading its data.
ParentControlID An optional ID of the parent DropDownList (on which the content of this control is based).
PromptText Optional text displayed by DropDownList a user has not yet touched. If omitted, the first dropdown item is selected.
PromptValue An optional value for an option displayed by DropDownList showing PromptText.
SelectedValue A selected value of the dropdown.
ServiceMethod The name of a web service method.
ServicePath A path to the helper web service.
UseContextKey Determines whether or not the ContextKey property should be used. It will be automatically enabled if the ContextKey property is ever set (either on the client or server side). If the context key is used, it should have the same signature with an additional parameter named contextKey of the string type.
UseHttpGet Determines whether or not to use the HTTP GET method for requesting data.

Methods

Name Description
ParseKnownCategoryValuesString(knownCategoryValues) A helper method to parse the private storage format used to communicate with known category/value pairs.
QuerySimpleCascadingDropDownDocument(document, documentHierarchy, knownCategoryValuesDictionary, category) A helper method to provide simple implementation of a method to query a data set and return relevant dropdown content.
QuerySimpleCascadingDropDownDocument(document, documentHierarchy, knownCategoryValuesDictionary, category, inputValidationRegex) A helper method to provide simple implementation of a method to query a data set and return relevant dropdown content.

Client properties

Name Description
category A string containing a category of this dropdown.
clearSelectedItemOnParentChange Always clear selected item when parent value changes.
contextKey A string containing user or page-specific context provided to an optional overload of the Web method described by ServiceMethod or ServicePath.
emptyText A string containing text for an option displayed when the list is empty.
emptyValue A string containing a value for an option displayed when the list is empty.
enableAtLoading Determines whether or not to disable the DropDownList control when it is waiting for data from the service, so on loading a user can use the keyboard to navigate to the drop-down control.
loadingText A string containing loading text to to be displayed when getting the dropdown's values from the Web service.
parentControlID A string containing an ID of a parent dropdown in a hierarchy of dropdowns.
promptText A string containing prompt text that is displayed as the first entry in the dropdown.
promptValue A string containing a value for an option displayed by DropDownList showing PromptText.
selectedValue A string containing the selected value of the dropdown.
serviceMethod A string containing the name of the method to invoke on the Web service.
servicePath A string containing a path of the Web service. The default is page path
useContextKey A boolean value that determines whether or not the ContextKey property should be used.
useHttpGet Determines whether or not to use the HTTP GET method for requesting data.

Client events

Name Description
populated Fires after the control is populated.
populating Fires when the control is being populated.
selectionChanged Fires when selection is changed.

Client properties

category

A string containing a category of this dropdown.

Getter name: get_category()
Setter name: set_category(value)

clearSelectedItemOnParentChange

Always clear selected item when parent value changes.

Getter name: get_clearSelectedItemOnParentChange()
Setter name: set_clearSelectedItemOnParentChange(value)

contextKey

A string containing user or page-specific context provided to an optional overload of the Web method described by ServiceMethod or ServicePath.

Remarks: If the context key is used, it should have the same signature with an additional parameter named contextKey of the string type.

Getter name: get_contextKey()
Setter name: set_contextKey(value)

emptyText

A string containing text for an option displayed when the list is empty.

Getter name: get_emptyText()
Setter name: set_emptyText(value)

emptyValue

A string containing a value for an option displayed when the list is empty.

Getter name: get_emptyValue()
Setter name: set_emptyValue(value)

enableAtLoading

Determines whether or not to disable the DropDownList control when it is waiting for data from the service, so on loading a user can use the keyboard to navigate to the drop-down control.

Getter name: get_enableAtLoading()
Setter name: set_enableAtLoading(value)

loadingText

A string containing loading text to to be displayed when getting the dropdown's values from the Web service.

Getter name: get_loadingText()
Setter name: set_loadingText(value)

parentControlID

A string containing an ID of a parent dropdown in a hierarchy of dropdowns.

Getter name: get_parentControlID()
Setter name: set_parentControlID(value)

promptText

A string containing prompt text that is displayed as the first entry in the dropdown.

Getter name: get_promptText()
Setter name: set_promptText(value)

promptValue

A string containing a value for an option displayed by DropDownList showing PromptText.

Getter name: get_promptValue()
Setter name: set_promptValue(value)

selectedValue

A string containing the selected value of the dropdown.

Getter name: get_selectedValue()
Setter name: set_selectedValue(value)

serviceMethod

A string containing the name of the method to invoke on the Web service.

Getter name: get_serviceMethod()
Setter name: set_serviceMethod(value)

servicePath

A string containing a path of the Web service. The default is page path

Getter name: get_servicePath()
Setter name: set_servicePath(value)

useContextKey

A boolean value that determines whether or not the ContextKey property should be used.

Remarks: The useContextKey property will be automatically enabled if the ContextKey property is ever set either on the client or server side. If the context key is used, it should have the same signature with an additional parameter named contextKey of the string type.

Getter name: get_useContextKey()
Setter name: set_useContextKey(value)

useHttpGet

Determines whether or not to use the HTTP GET method for requesting data.

Getter name: get_useHttpGet()
Setter name: set_useHttpGet(value)

Methods

ParseKnownCategoryValuesString(knownCategoryValues)

A helper method to parse the private storage format used to communicate with known category/value pairs.

Params:

  • knownCategoryValues
    • Type:
    • Description: Private storage format string

QuerySimpleCascadingDropDownDocument(document, documentHierarchy, knownCategoryValuesDictionary, category)

A helper method to provide simple implementation of a method to query a data set and return relevant dropdown content.

Params:

  • document

    • Type:
    • Description: XML document containing the data set
  • documentHierarchy

    • Type:
    • Description: List of strings representing the hierarchy of the data set
  • knownCategoryValuesDictionary

    • Type:
    • Description: Known category/value pairs
  • category

    • Type:
    • Description: Category for which the drop down contents are desired

QuerySimpleCascadingDropDownDocument(document, documentHierarchy, knownCategoryValuesDictionary, category, inputValidationRegex)

A helper method to provide simple implementation of a method to query a data set and return relevant dropdown content.

Params:

  • document

    • Type:
    • Description: XML document containing the data set
  • documentHierarchy

    • Type:
    • Description: List of strings representing the hierarchy of the data set
  • knownCategoryValuesDictionary

    • Type:
    • Description: Known category/value pairs
  • category

    • Type:
    • Description: Category for which the drop down contents are desired
  • inputValidationRegex

    • Type:
    • Description: Regular expression used to validate user input to the web service (to prevent XPath injection attacks)

Client events

populated

Fires after the control is populated.

Add event handler method: add_populated(handler)
Remove event handler method: remove_populated(handler)
Raise event method: raise_populated()

populating

Fires when the control is being populated.

Add event handler method: add_populating(handler)
Remove event handler method: remove_populating(handler)
Raise event method: raise_populating()

selectionChanged

Fires when selection is changed.

Add event handler method: add_selectionChanged(handler)
Remove event handler method: remove_selectionChanged(handler)
Raise event method: raise_selectionChanged()

Clone this wiki locally