This is a migrated thread and some comments may be shown as answers.

How to determine what called RadContextMenu?

1 Answer 82 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 23 Jun 2009, 06:52 PM
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

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Jun 2009, 07:00 AM
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.
Tags
Menu
Asked by
Bill
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or