fire itemclick event

2 posts, 0 answers
  1. Sigma
    Sigma avatar
    87 posts
    Member since:
    Apr 2012

    Posted 10 Dec 2012 Link to this post

    How can i fire itemclick event when the navigateurl property of menuitem is set
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Dec 2012 Link to this post

    Hi Sigma,

    One of the possible solutions is to subscribe to the ItemDataBound / ItemCreated event and set the NavigateUrl property to an empty string as follows.

    ASPX:
    <telerik:RadMenuItem runat="server" Text="This item will not fire ItemClick event"  NavigateUrl="myPage.aspx">               
    </telerik:RadMenuItem>

    C#:
    protected void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)     
    {         
        e.Item.Attributes["NavigateUrl"] = e.Item.NavigateUrl;         
        e.Item.NavigateUrl = "";     
    }          
    protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
    {         
        //Custom code here                    
        //Navigate         
        Response.Redirect(e.Item.Attributes["NavigateUrl"].ToString());     
    }

    Please take a look into this documentation for more information.

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top