Server-side Programming Overview
Overview of the Server-side APIs you can use to create and configure the Telerik WebForms Chip Control.
Creating the Chip in the Markup
To create a Chip in the markup, add the RadChip
element to the page and set its properties accordingly. You can find the properties in the following article:
Example
<telerik:RadChip runat="server" Label="Chip Text" Size="Large" FillMode="Outline" ThemeColor="Success" />
Creating an Chip dynamically
To create the Chip on the server, create a new instance of the RadChip
object, set its properties and add it to the Controls collection of another control (e.g. PlaceHolder1
).
You can find the properties and enums in the following articles:
Example
protected void Page_PreInit(object sender, EventArgs e)
{
RadChip chip = new RadChip()
{
Label = "Success",
Size = ChipSize.Large,
Rounded = ChipRounded.Full,
FillMode = ChipFillMode.Outline,
ThemeColor = ChipThemeColor.Success
};
PlaceHolder1.Controls.Add(chip);
}
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs) Handles Me.PreInit
Dim chip As RadChip = New RadChip() With {
.Label = "Success",
.Size = ChipSize.Large,
.Rounded = ChipRounded.Full,
.FillMode = ChipFillMode.Outline,
.ThemeColor = ChipThemeColor.Success
}
PlaceHolder1.Controls.Add(chip)
End Sub
The PlaceHolder1
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
Creating controls programmatically must be done in an early event such as PreInit (preferably), Init. For more details you can check out the ASP.NET Page Life-Cycle Events