title | page_title | description | slug | tags | published | position |
---|---|---|---|---|---|---|
Getting Started |
Getting Started with the Badge |
Get started with the WebForms Badge by Telerik UI for ASP.NET AJAX and learn how to create, initialize, and enable the component. |
badge/getting-started |
badge,getting started |
true |
1 |
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:
To create the Badge in the markup, add a telerik:RadBadge
element to the page and configure its options, like Icon
, and Text
.
<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
)
protected void Page_PreInit(object sender, EventArgs e)
{
RadBadge badge = new RadBadge()
{
Text = "Badge",
ThemeColor = BadgeThemeColor.Primary
};
PlaceHolder1.Controls.Add(badge);
}
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs) Handles Me.PreInit
Dim badge As RadBadge = New RadBadge() With {
.Text = "Badge",
.ThemeColor = BadgeThemeColor.Primary
}
PlaceHolder1.Controls.Add(badge)
End Sub
The PlaceHolder1
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
important 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
- [Change the Appearance]({%slug badge/appearance%})
- [Client-side Programming]({%slug badge/client-side-programming/overview%})
- [Server-side Programming]({%slug badge/server-side-programming/overview%})