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

Getting Started with the Telerik WebForms Label

This article describes a sample scenario where RadLabel is used with a RadDatePicker control.

  1. Add a RadLabel control to the page.

    <telerik:RadLabel runat="server" ID="RadLabel1" Text="sample text">
    </telerik:RadLabel>
    
  2. Next, place a RadDatePicker control on the page.

    <telerik:RadDatePicker RenderMode="Lightweight" runat="server" ID="RadDatePicker1">
    </telerik:RadDatePicker>
    
  3. 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>
    
  4. 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 />
    
  5. 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 />
    
  6. 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>
    
In this article