New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Getting Started with the Badge

This guide demonstrates how to get up and running with the Telerik WebForms Badge.

After the completion of this guide, you will be able to achieve the following end result:

"Getting Started with the Badge"

Create the Badge

To create the Badge in the markup, add a telerik:RadBadge element to the page and configure its options, like Icon, and Text.

ASP.NET
<telerik:RadBadge runat="server" ID="Badge1" Text="Badge" ThemeColor="Primary" />

To create the Badge on the server, create a new instance of the RadBadge object, and add it to the Controls collection of another control (e.g. PlaceHolder1)

C#
protected void Page_PreInit(object sender, EventArgs e)
{
    RadBadge badge = new RadBadge()
    {
        Text = "Badge",
        ThemeColor = BadgeThemeColor.Primary
    };

    PlaceHolder1.Controls.Add(badge);
}

The PlaceHolder1

ASP.NET
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

Creating controls programmatically must be done in an early event such as PreInit (preferably), and Init. For more details you can check out the ASP.NET Page Life-Cycle Events

Next Steps

In this article
Create the BadgeNext Steps
Not finding the help you need?
Contact Support