ComponentOne Slider for ASP.NET AJAX: Slider for ASP.NET AJAX Task-Based Help > Creating a C1Slider in Code

Creating a C1Slider in Code

Creating a C1Slider control in code is fairly simple. In the following steps you'll add a PlaceHolder control to the page, add an import statement, add and customize the C1Slider, and add the control to the PlaceHolder.

Complete the following steps:

1.   In Design view, navigate to the Visual Studio Toolbox and add a PlaceHolder control to your page.

2.   Double-click the page to create the Page_Load event and switch to Code view.

3.   Add the following statement to the top of the Code Editor to import the appropriate namespace:

      Visual Basic

Imports C1.Web.UI.Controls.C1Slider

      C#

using C1.Web.UI.Controls.C1Slider;

4.   Add the following code to the Page_Load event to create and customize the C1Slider control.

      Visual Basic

' Create a new C1Slider.

Dim slide As New C1Slider

' Add the C1Slider to the PlaceHolder control.

PlaceHolder1.Controls.Add(slide)

' Set the control's size and appearance.

slide.MinimumValue = 1

slide.MaximumValue = 10

slide.Value = 5

slide.VisualStyle = "ArcticFox"

slide.Width = 250

      C#

// Create a new C1Slider.

C1Slider slide = new C1Slider();

// Add the C1Slider to the PlaceHolder control.

PlaceHolder1.Controls.Add(slide);

// Set the control's size and appearance.

slide.MinimumValue = 1;

slide.MaximumValue = 10;

slide.Value = 5;

slide.VisualStyle = "ArcticFox";

slide.Width = 250;


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.