New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Server-side Programming Overview
Overview of the Server-side APIs you can use to create and configure the Telerik WebForms ChipList Control.
Creating the ChipList in the Markup
To create a ChipList in the markup:
- add a
RadChipList
element to the page and set its properties, see ChipList Properties - add two or more
ChipListItem
elements to theItems
collection and set their properties, see ChipListItem Properties
Example
ASP.NET
<telerik:RadChipList runat="server" ID="RadChipList1" FillMode="Outline" Rounded="Full" Removable="true" ItemSize="Large">
<Items>
<telerik:ChipListItem Icon="info-circle" Label="Info" ThemeColor="Info" />
<telerik:ChipListItem Icon="check-outline" Label="Success" ThemeColor="Success" />
<telerik:ChipListItem Icon="exclamation-circle" Label="Warning" ThemeColor="Warning" />
<telerik:ChipListItem Icon="x-outline" Label="Error" ThemeColor="Error" />
</Items>
</telerik:RadChipList>
Creating an ChipList dynamically
To create the ChipList on the server
- create a new instance of the
RadChipList
object and set its properties, see ChipList Properties. - add two or more
ChipListItem
objects to theItems
collection and set their properties, see ChipListItem Properties. - add the ChipList to the Controls collection of another control (e.g.
PlaceHolder1
).
Example
C#
protected void Page_PreInit(object sender, EventArgs e)
{
RadChipList chiplist = new RadChipList() { ID = "RadChipList1", FillMode = ChipListFillMode.Outline, Rounded = ChipListRounded.Full, Removable = true };
chiplist.Items.Add(new ChipListItem() { Icon = "info-circle", Label = "Info", ThemeColor = ChipThemeColor.Info });
chiplist.Items.Add(new ChipListItem() { Icon = "check-outline", Label = "Success", ThemeColor = ChipThemeColor.Success });
chiplist.Items.Add(new ChipListItem() { Icon = "exclamation-circle", Label = "Warning", ThemeColor = ChipThemeColor.Warning });
chiplist.Items.Add(new ChipListItem() { Icon = "x-outline", Label = "Error", ThemeColor = ChipThemeColor.Error });
PlaceHolder1.Controls.Add(chiplist);
}
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), Init. For more details you can check out the ASP.NET Page Life-Cycle Events