How to determine what called RadContextMenu?

2 posts, 0 answers
  1. Bill
    Bill avatar
    4 posts
    Member since:
    Mar 2009

    Posted 23 Jun 2009 Link to this post

    I have multiple buttons on a page that all call the same RadContextMenu: 

     

     

     

    <button id="btnOne" runat="server" class="button" onclick="showMenu(event)">Process</button> 
    <button id="btnTwo" runat="server" class="button" onclick="showMenu(event)">Process</button> 
     
    <Telerik:RadContextMenu id="RadContextMenu1" runat="server" Skin="WebBlue" OnItemClick="RadContextMenu1_ItemClick" >   
    <Items>   
    <Telerik:RadMenuItem Text="Accept" runat="server" />   
    <Telerik:RadMenuItem Text="Reject" runat="server" />   
    </Items>   
    </Telerik:RadContextMenu>   
     

     

     

     

    In the server side code:

     

     

    protected void RadContextMenu1_ItemClick(object sender, RadMenuEventArgs e)      
    {     

     

     

     

    ...how can I find out which button's menu was actually clicked?

    Thanks.

    Bill

     

     

     

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jun 2009 Link to this post

    Hi Bill,

    In the ShowMenu() function you can easily determine which button is clicked. See the client side code below.

    JavaScript:
     
    <script type="text/javascript">  
    function showMenu(e)  
    {  
        alert(e.srcElement.id); // Id of clicked button  
        //Show menu  
    }  
    </script> 
    Note: You can set the value to a HiddenField control if you want to access it in server side.

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