Skip to main content

Bind ASPxTrackBar to a Data Source

  • 2 minutes to read

You can bind the ASPxTrackBar control to a data source to populate items automatically. The control can be bound to any object that implements the IHierarchicalEnumerable or IHierarchicalDataSource interface (for example, SiteMapDataSource, XmlDataSource).

Use one of the following ASPxTrackBar control properties to specify a data source:

The ASPxTrackBar control supports two methods to retrieve data from a specified data source.

Regardless of the technique you choose to use, the ASPxTrackBar control automatically creates TrackBarItem objects and retrieves their property values from the corresponding nodes.

Specify the data source for a track bar at design time

You can specify a data source for a track bar at design time. Invoke ASPxTrackBar’s smart tag menu and select New Data Source… in the Choose Data Source pulldown menu.

trackbar_concepts_databinding1

In the invoked Data Source Configuration Wizard, select the required data source type and follow the wizard instructions.

trackbar_concepts_databinding2

Specify the data source for a track bar in markup

trackbar_example_items_range

The code sample below demonstrates how to bind ASPxTrackBar to an Xml data source.

<?xml version="1.0" encoding="utf-8" ?>
<TimeLapse>
  <Day DayOfWeek="Monday" ToolTip="Monday" Text="Mon" />
  <Day DayOfWeek="Tuesday" ToolTip="Tuesday" Text="Tue" />
  <Day DayOfWeek="Wednesday" ToolTip="Wednesday" Text="Wed" />
  <Day DayOfWeek="Thursday" ToolTip="Thursday" Text="Thu" />
  <Day DayOfWeek="Friday" ToolTip="Friday" Text="Fri" />
  <Day DayOfWeek="Saturday" ToolTip="Saturday" Text="Sat" />
  <Day DayOfWeek="Sunday" ToolTip="Sunday" Text="Sun" />
</TimeLapse>