Getting Started with the Telerik WebForms Label
This article describes a sample scenario where RadLabel is used with a RadDatePicker control.
Add a RadLabel control to the page.
<telerik:RadLabel runat="server" ID="RadLabel1" Text="sample text">
</telerik:RadLabel>
Next, place a RadDatePicker control on the page.
<telerik:RadDatePicker RenderMode="Lightweight" runat="server" ID="RadDatePicker1">
</telerik:RadDatePicker>
Set the AssociatedControlID property of RadLabel to be the same as the ID of the RadDatePicker. After that when you click on the Label the DateInput will be focused.
<telerik:RadLabel runat="server" ID="RadLabel1" Text="sample text" AssociatedControlID="RadDatePicker1">
</telerik:RadLabel>
Optional If you prefer the label to be on a different line you can add a <br>
element after the label.
<telerik:RadLabel runat="server" ID="RadLabel1" Text="sample text" AssociatedControlID="RadDatePicker1">
</telerik:RadLabel>
<br />
- Optional In addition you can use an image instead of text for the label. To do this you should place an image inside the RadLabel tags.
<telerik:RadLabel runat="server" ID="RadLabel1" AssociatedControlID="RadDatePicker1">
<img src="/images/myImage.png" alt="" />
</telerik:RadLabel>
<br />
- The complete markup looks like below:
<telerik:RadLabel runat="server" ID="RadLabel1" AssociatedControlID="RadDatePicker1">
<img src="/images/myImage.png" alt="" />
</telerik:RadLabel>
<br />
<telerik:RadDatePicker RenderMode="Lightweight" runat="server" ID="RadDatePicker1"></telerik:RadDatePicker>