ItemCreated not firing

2 posts, 0 answers
  1. DMC Helpdesk
    DMC Helpdesk avatar
    52 posts
    Member since:
    Nov 2007

    Posted 22 Jun 2010 Link to this post

    My ASPX code:
    <telerik:RadToolBar ID="mainToolBar" runat="server"  
                            Style="z-index: 90001" Width="100%" 
                                <telerik:RadToolBarButton ImageUrl="~/images/toolbar/New.gif" AccessKey="N" Text="<u>N</u>ew" 
                                    ToolTip="New" Value="New"
                                <telerik:RadToolBarButton IsSeparator="true" /> 
                                <telerik:RadToolBarButton ImageUrl="~/images/toolbar/print.gif" ToolTip="Print" CommandName="Print" 
                                    Value="Print" /> 
                                <telerik:RadToolBarButton ImageUrl="~/images/toolbar/Excel.png" AccessKey="N" ToolTip="Excel" 
                                    Value="ExportToExcel" PostBack="false"
                                <telerik:RadToolBarButton IsSeparator="true" /> 
                                <telerik:RadToolBarButton ImageUrl="~/images/toolbar/Refresh.gif" ToolTip="Refresh" 
                                    Value="Refresh" PostBack="false"/> 
                                <telerik:RadToolBarButton IsSeparator="true" /> 
                                <telerik:RadToolBarButton ImageUrl="~/images/toolbar/delete.gif" ToolTip="Delete" 
                                    Value="Delete" PostBack="false" /> 
                                    <telerik:RadToolBarButton Value="Search" > 

    my CS code:
     protected void mainToolBar_ItemCreated(object sender, Telerik.Web.UI.RadToolBarEventArgs e) 
            throw new Exception("ItemCreated fired");  

    Thanks in advance
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Jun 2010 Link to this post


    The ItemCreated event occurs for each new item that is added to the Items collection of the toolbar. In other words, the event fires when adding a dynamically created RadToolBarItem to RadToolBar, or when binding the toolbar to a data source.

    If you wand to access the items in RadToolBar, then you can iterate through the items as shown below.
            foreach( RadToolBarItem item in mainToolBar.Items ) 
                 // Your code to modify items 

Back to Top