Client-Side API
- 3 minutes to read
The ASPxClientTrackBar object is the client-side equivalent of the ASPxTrackBar control. This object exposes the control’s comprehensive client-side API.
ASPxClientTrackBar implements functionality that allows you to execute the following track bar related actions on the client.
- Manipulate drag handle positions
- Respond to end-user changes in drag handle position
- Obtain track bar item information
In addition, ASPxClientTrackBar exposes the common client API, which it inherits from its direct ansestor - ASPxClientEdit.
Refer to the following topic to learn more about DevExpress client-side model implementation: Client-Side Functionality Overview.
#Manipulate drag handle positions
Depending upon the selection mode applied, you can use different client methods to obtain or change drag handle positions on the client side.
Single value selection mode
Use the following methods to change the position of the main drag handle.
Method Description ASPx Client Track Bar. Get Position Gets a drag handle position. ASPx Client Track Bar. Set Position Specifies a drag handle position. Range selection mode
Use the following methods to change the position of the main and secondary drag handles.
Method Description ASPx Client Track Bar. Get Position Start Returns the main drag handle position. ASPx Client Track Bar. Get Position End Returns the secondary drag handle position. ASPx Client Track Bar. Set Position Start Specifies the main drag handle position. ASPx Client Track Bar. Set Position End Specifies the secondary drag handle position.
#Respond to end-user changes in drag handle position
Each time a user manipulates ASPxTrackBar‘s elements on the client, you can handle specific exposed client events in response. The available client events fall into the following two categories.
Selection change
You can use the following events to respond to a user’s selection change and cancel the user’s action. Refer to the following topic to learn how users can change selection: Value Selection.
Event Description ASPx Client Track Bar. Position Changing Occurs on the client before a user changes track bar position. ASPx Client Track Bar. Position Changed Fires after the editor’s position has been changed. Handle drag
The following events allow you to respond to drag handle changes:
Event Description ASPx Client Track Bar. Track Start Occurs on the client-side when an end-user presses a drag handle and moves it. ASPx Client Track Bar. Track Occurs on the client-side when an end-user moves a cursor while the drag handle is held down. ASPx Client Track Bar. Track End Occurs on the client-side when an end-user releases a drag handle after moving it.
#Obtain track bar item information
In items mode, ASPxTrackBar allows you to use item-related methods on the client to obtain information about track bar items.
Collection-related info (item index and total count)
Use the following methods to get either the total number of items in the ASPxTrackBar.Items collection or the index of a specific item.
Event Description ASPx Client Track Bar. Get Item Count Returns the number of track bar items that are maintained by the item collection. ASPx Client Track Bar. Get Item Index By Value Returns a track bar item index by the item’s value. Individual item settings
You can obtain settings (such as text, value and tooltip text) of a particular item specified by its collection index.
Event Description ASPx Client Track Bar. Get Item Text Returns a track bar item’s text. ASPx Client Track Bar. Get Item Value Returns a track bar item’s associated value. ASPx Client Track Bar. Get Item Tool Tip Returns a track bar item’s tooltip text.
Refer to the following example for details on how to use ASPxTrackBar‘s client API: