Control Events in RadMenu Template

2 posts, 1 answers
  1. Matt
    Matt avatar
    58 posts
    Member since:
    Jun 2009

    Posted 03 Feb 2010 Link to this post

    Hi,

    Should event handling work the same way for controls in a RadMenus templates as per normal asp.net?

    I have

    <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2007" OnItemClick="RadMenu1_ItemClick">  
            <Items> 
                <telerik:RadMenuItem runat="server" Text="Link Type">  
                    <Items> 
                        <telerik:RadMenuItem runat="server" Text="Test" Width="150px">  
                            <ItemTemplate> 
                                <asp:RadioButtonList ID="phrasepagetypeRadioButtonList" runat="server"   
                                    Width="150px"   
                                    onselectedindexchanged="phrasepagetypeRadioButtonList_SelectedIndexChanged">  
                                    <asp:ListItem Value="99" Selected="True">All</asp:ListItem> 
                                    <asp:ListItem Value="0">Product</asp:ListItem> 
                                    <asp:ListItem Value="1">Inspect</asp:ListItem> 
                                </asp:RadioButtonList> 
                            </ItemTemplate> 
                        </telerik:RadMenuItem> 
                    </Items> 
                </telerik:RadMenuItem> 
    ... and so on

    and when I click the radio buttons no event fires, but when I click on the menu name I get the phrasepagetypeRadioButtonList_SelectedIndexChanged event firing and then the radmenu item clicked event afterwards????

    protected

     

    void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)

     

    {

    }

     

    protected void phrasepagetypeRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)

     

    {

    }

    Thanks
    Matt

  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Feb 2010 Link to this post

    Hello Mathew,

    The control will work same as normal way evenif it is placed in ItemTemplate of Telerik control. You could set the AutoPostBack property of RadioButtonList to True in order to fire the SelectedIndexChanged to fire when selecting the radiobutton.

    aspx:
     
    <telerik:RadMenu ID="RadMenu2" runat="server" Skin="Office2007" OnItemClick="RadMenu2_ItemClick"
        <Items> 
            <telerik:RadMenuItem runat="server" Text="Link Type"
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Test" Width="150px"
                        <ItemTemplate> 
                            <asp:RadioButtonList ID="phrasepagetypeRadioButtonList" runat="server" Width="150px" 
                                OnSelectedIndexChanged="phrasepagetypeRadioButtonList_SelectedIndexChanged" AutoPostBack="True"
                                <asp:ListItem Value="99" Selected="True">All</asp:ListItem> 
                                <asp:ListItem Value="0">Product</asp:ListItem> 
                                <asp:ListItem Value="1">Inspect</asp:ListItem> 
                            </asp:RadioButtonList> 
                        </ItemTemplate> 
                    </telerik:RadMenuItem> 
                </Items> 
            </telerik:RadMenuItem> 
        </Items> 
    </telerik:RadMenu> 

    -Shinu.
Back to Top