Getting Started with the Chip
This guide demonstrates how to get up and running with the Telerik WebForms Chip.
After the completion of this guide, you will be able to achieve the following end result:
Create the Chip
To create the Chip in the markup, add a telerik:RadChip
element to the page and configure its options, like Icon
, and Label
.
<telerik:RadChip runat="server" ID="RadChip1" Icon="save" Label="Save"></telerik:RadChip>
To create the Chip on the server, create a new instance of the RadChip
object, like Icon
, and Label
, and add it to the Controls collection of another control (e.g. PlaceHolder1
)
protected void Page_PreInit(object sender, EventArgs e)
{
RadChip chip = new RadChip() {
Icon = "save",
Label = "Save"
};
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 {
.Icon = "save",
.Label = "Save"
}
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), and Init. For more details you can check out the ASP.NET Page Life-Cycle Events