New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Label Integration

This help article illustrates how to integrate RadSwitch with RadLabel, ASP:Label and HTML Label element.

RadLabel Integration

You can use RadLabel to configure the text that appears before/after RadSwitch. This would let you use the embedded functionality of RadLabel like marks, custom HTML and skinning.

To integrate RadSwitch with RadLabel you should simply set the AssociatedControlID property of the label control to the ID of the switch control it will be attached to (Example 1).

Example 1: RadLabel can be integrated with RadSwitch.

<telerik:RadLabel runat="server" ID="RadLabel1" AssociatedControlID="RadSwitch1" Text="RadLabel for RadSwitch">
</telerik:RadLabel>
<telerik:RadSwitch runat="server" ID="RadSwitch1" Checked="true">
</telerik:RadSwitch>

ASP:Label Integration

To integrate RadSwitch with ASP:Label you should simply set the AssociatedControlID property of the label control to the ID of the switch control it will be attached to (Example 2).

Example 2: ASP:Label can be integrated with RadSwitch.

<asp:Label ID="Label1" runat="server" Text="aspLabel for RadSwitch" AssociatedControlID="RadSwitch2" />
<telerik:RadSwitch ID="RadSwitch2" runat="server" Checked="true">
</telerik:RadSwitch>

HTML Label Integration

To integrate RadSwitch with HTML Label you should simply set the for attribute of the label control to the ID of the switch control it will be attached to (Example 3).

Example 3: HTML Label can be integrated with RadSwitch.

<label for="RadSwitch3">HTML Label</label>
<telerik:RadSwitch ID="RadSwitch3" runat="server" Checked="true">
</telerik:RadSwitch>

See Also

In this article