Version

Spinning through a list of values in WebDatePicker

WebDatePicker™ provides the option to spin through a list of values using spin buttons. You can display the spin buttons by setting the SpinButtonsDisplay property to either OnRight or OnLeft. By default, this property is set to None. The spin buttons have two buttons: lower and upper so that your end-users can move to the next and previous values. You can customize the lower and upper buttons by setting the LowerSpinButton and UpperSpinButton properties respectively.

You can set the SpinButtonsDisplay property either using Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

'Displays the spin buttons on the right
WebDatePicker1.Buttons.SpinButtonsDisplay = Infragistics.Web.UI.EditorControls.ButtonDisplay.OnRight

In C#:

//Displays the spin buttons on the right
WebDatePicker1.Buttons.SpinButtonsDisplay = Infragistics.Web.UI.EditorControls.ButtonDisplay.OnRight;

WebDatePicker also allows you to spin through the list continuously even if it reaches the first or last value in the list by setting the SpinWrap property to True.

Add and Insert Values into the list

WebDatePicker allows you to add a list of values that you want to iterate through using the TextEditorButtons object’s ListOfValues property. You can set the ListOfValues property either using Microsoft® Visual Studio® Property Window:

In Visual Basic:

WebDatePicker1.Buttons.ListOfValues = "2009-02-02-11-30-15-20|2009-03-03-12-30-15-20|2009-04-04-15-22-20-33|2009-05-05-18-23-20-35"

In C#:

WebDatePicker1.Buttons.ListOfValues = "2009-02-02-11-30-15-20|2009-03-03-12-30-15-20|2009-04-04-15-22-20-33|2009-05-05-18-23-20-35";
Note
Note:

Items in the list must be separated by the "|" character when using the ListOfValues property. The format of the values in the list of values must be in the "YYYY-MM-DD-HH-mm-ss-ms" (yyyy –year; MM-month; DD-date; HH –hours; mm-minutes; ss-seconds; ms – milliseconds) format.

However you can also insert values into the list using the TextEditorButtons object’s InsertListValueAtIndex method.

In Visual Basic:

'Insert the values into the list at a particular index
 WebDatePicker1.Buttons.InsertListValueAtIndex(0, "2009-02-02-11-30-15-20")
 WebDatePicker1.Buttons.InsertListValueAtIndex(1, "2009-03-03-12-30-15-20")
 WebDatePicker1.Buttons.InsertListValueAtIndex(2, "2009-04-04-15-22-20-33")
 WebDatePicker1.Buttons.InsertListValueAtIndex(3, "2009-05-05-18-23-20-35")

In C#:

//Insert the values into the list at a particular index
WebDatePicker1.Buttons.InsertListValueAtIndex(0, "2009-02-02-11-30-15-20");
WebDatePicker1.Buttons.InsertListValueAtIndex(1, "2009-03-03-12-30-15-20");
WebDatePicker1.Buttons.InsertListValueAtIndex(2, "2009-04-04-15-22-20-33");
WebDatePicker1.Buttons.InsertListValueAtIndex(3, "2009-05-05-18-23-20-35");

Increment/Decrement the editing value

WebDatePicker also allows you to increment/decrement the editing value using the spin buttons. You can set the increment/decrement factor by simply setting the SpinDelta property. For instance, if you set the SpinDelta property to 10 then clicking the upper button increases the value by 10 days if it is in the date format or by 10 minutes if it is in the time format. Similarly, clicking the lower button decreases the value by 10 days if it is in the date format or by 10 minutes if it is in the time format.

You can set the SpinDelta property either using Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

WebDatePicker1.SpinDelta = 10

In C#:

WebDatePicker1.SpinDelta = 10;
Note
Note:

The ListOfValues property has higher priority than the SpinDelta property.