I am trying to add an image to a radgrid column that when hovered or clicked opens a context menu. The context menu contains a series of commands that i want to launch rad windows based on the command clicked and the datakey of the grid row.
I have found examples doing each thing individually but none that do this all together. Below is the code i am using. The showMenu Portion works fine. Now how do i get the contextmenuitem clicked and the datakeyname for the row it was clicked in so i can determine which radwindows to open pass it the productid for the row the contextmenu was clicked on?
Thanks for any help,
Kevin
I have found examples doing each thing individually but none that do this all together. Below is the code i am using. The showMenu Portion works fine. Now how do i get the contextmenuitem clicked and the datakeyname for the row it was clicked in so i can determine which radwindows to open pass it the productid for the row the contextmenu was clicked on?
Thanks for any help,
Kevin
| <script type="text/javascript"> |
| function showMenu(e) |
| { |
| var contextMenu = $find("<%= RadContextMenu1.ClientID %>"); |
| if ((!e.relatedTarget) || (!Telerik.Web.DomUtility.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget))) |
| { |
| contextMenu.show(e); |
| } |
| Telerik.Web.DomElement.cancelRawEvent(e); |
| } |
| function openDeleteWindow(ProductID) |
| { |
| var oPWResetWnd = radopen("../DeleteProductRequest.aspx?ProductID=" +ProductID, "RadWindow1" ); |
| oPWResetWnd.Center(); |
| oPWResetWnd.setSize(800,600); |
| } |
| </script> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" |
| GridLines="None"> |
| <MasterTableView TableLayout="Auto" AutoGenerateColumns="False" |
| DataKeyNames="Product"> |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn"> |
| <ItemTemplate> |
| <asp:Image ID="imgManage" runat="server" ImageUrl="~/Images/v3_btn_manage.gif" |
| onmouseover="showMenu(event)" onclick="showMenu(event)" alt="" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue" Width="600px" |
| Height="400px" /> |
| <telerik:RadContextMenu ID="RadContextMenu1" runat="server" Flow="Horizontal"> |
| <Items> |
| <telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Edit"> |
| <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Delete"> |
| <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> |
| </telerik:RadMenuItem> |
| </Items> |
| </telerik:RadContextMenu> |