Getting Started Overview
The following tutorial demonstrates using RadSlider to interact with the month of a Standard ASP.NET Calendar control. The tutorial shows how to set minimum and maximum values, change the current slider value, respond to value changes and set the skin.
-
In the default page of a new ASP.NET AJAX-enabled Web Application add a Standard Calendar control and a RadSlider.
-
In the Properties Window for the Calendar control set the PrevMonthText and NextMonthText properties to blank ("").
-
Open the RadSlider Smart Tag and select "Office2007" from the Skin drop down list.
-
In the Properties Window for the RadSlider set the following properties:
- AutoPostBack = True
- MinimumValue = 1
- MaximumValue = 12
-
In the Properties Window, click the Events button (). Double-click the ValueChanged event to create an event handler. Replace the event handler with the code below.
C#protected void RadSlider1_ValueChanged(object sender, EventArgs e) { Calendar1.VisibleDate = new DateTime(DateTime.Today.Year, (int)RadSlider1.Value, 1); }
VBProtected Sub RadSlider1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Calendar1.VisibleDate = New DateTime(DateTime.Today.Year, DirectCast(RadSlider1.Value, Integer), 1) End Sub
-
Replace the Page_Load event handler with the code below:
C#protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RadSlider1.Value = Calendar1.VisibleDate.Month; } }
VBProtected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If Not IsPostBack Then RadSlider1.Value = Calendar1.VisibleDate.Month End If End Sub
-
Press F5 to run the application. Drag the slider and observe the change to the Calendar. Notice that you can't drag the slider outside the minimum and maximum values of 1..12.