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 ASPxClientTrackBar.GetPosition Gets a drag handle position. ASPxClientTrackBar.SetPosition 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 ASPxClientTrackBar.GetPositionStart Returns the main drag handle position. ASPxClientTrackBar.GetPositionEnd Returns the secondary drag handle position. ASPxClientTrackBar.SetPositionStart Specifies the main drag handle position. ASPxClientTrackBar.SetPositionEnd 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 ASPxClientTrackBar.PositionChanging Occurs on the client before a user changes track bar position. ASPxClientTrackBar.PositionChanged Fires after the editor’s position has been changed. Handle drag
The following events allow you to respond to drag handle changes:
Event Description ASPxClientTrackBar.TrackStart Occurs on the client-side when an end-user presses a drag handle and moves it. ASPxClientTrackBar.Track Occurs on the client-side when an end-user moves a cursor while the drag handle is held down. ASPxClientTrackBar.TrackEnd 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 ASPxClientTrackBar.GetItemCount Returns the number of track bar items that are maintained by the item collection. ASPxClientTrackBar.GetItemIndexByValue 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 ASPxClientTrackBar.GetItemText Returns a track bar item’s text. ASPxClientTrackBar.GetItemValue Returns a track bar item’s associated value. ASPxClientTrackBar.GetItemToolTip Returns a track bar item’s tooltip text.
Refer to the following example for details on how to use ASPxTrackBar‘s client API: