Edit this page


The ItemCreated event occurs for each new item that is added to the Items collection of the RadListBox.


If the item is added from a data source (the DataSource or DataSourceID property specifies the source of the items), it is a good idea to use the ItemDataBound event instead. ItemCreated occurs before the ItemDataBound event (before any item properties have been set to reflect the data in the data source).

The ItemCreated event handler receives two arguments:

  • The RadListBox that is loading items. This argument is of type object, but can be cast to the RadListBox type.

  • An EventArgs object of type RadListBoxItemEventArgs. This object has an Item property, which provides access to the item that has just been added.

protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)
        RadListBoxItem newItem = new RadListBoxItem("New Item", "NewItemValue");

protected void RadListBox1_ItemCreated(object sender, RadListBoxItemEventArgs e)
    RadListBoxItem newItem = e.Item;
    if (newItem.Text == "New Item")
        newItem.Enabled = false;
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        Dim newItem As New RadListBoxItem("New Item", "NewItemValue")
    End If
End Sub

Protected Sub RadListBox1_ItemCreated(sender As Object, e As RadListBoxItemEventArgs)
    Dim newItem As RadListBoxItem = e.Item
    If newItem.Text = "New Item" Then
        newItem.Enabled = False
    End If
End Sub

See Also

Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article