3 Answers, 1 is accepted
0
Hello Venkata,
You can use the following approach:
JavaScript:
Hope this helps.
Greetings,
Eyup
the Telerik team
You can use the following approach:
<ClientSettings> <ClientEvents OnHeaderMenuShowing="headerMenuShowing" /></ClientSettings>function headerMenuShowing(sender, args) { if (args.get_gridColumn().get_uniqueName() != "GridHyperLinkColumnName") { args.set_cancel(true); }}Hope this helps.
Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Venkata
Top achievements
Rank 1
answered on 12 Apr 2013, 07:56 PM
No.. the context Menu is not for Header Row.
I have to show context Menu on ROW GridHyperLinkColumn (when right click on HyperLink Item)
I tried following approach but getting error:
JavaScript:
but getting error here eventArgs.get_gridColumn().get_uniqueName(); Object doesn't support this property or method
what i am doing wrong here?
So How do i show RowContextMenu When User right click on HyperLink Item?
I have to show context Menu on ROW GridHyperLinkColumn (when right click on HyperLink Item)
I tried following approach but getting error:
<ClientSettings > <ClientEvents OnRowContextMenu="RowContextMenu" ></ClientEvents> </ClientSettings>JavaScript:
function RowContextMenu(sender, eventArgs){ if (eventArgs.get_gridColumn().get_uniqueName() != "GridHyperLinkColumnName") { eventArgs.set_cancel(true); } var menu = $find("<%=RadContextMenu1.ClientID %>"); menu.show(evt); evt.cancelBubble = true; evt.returnValue = false; if (evt.stopPropagation) { evt.stopPropagation(); evt.preventDefault(); }}but getting error here eventArgs.get_gridColumn().get_uniqueName(); Object doesn't support this property or method
what i am doing wrong here?
So How do i show RowContextMenu When User right click on HyperLink Item?
0
Hello Venkata,
I suppose you are using the following example for reference:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandmenu/defaultcs.aspx?product=grid
In this case, please verify that you have removed the second part of the following condition, since the HyperLink generates an anchor element:
Alternatively, you can use a GridTemplateColumn with asp:HyperLinks in its ItemTemplate and attach the oncontextmenu client side event handler. In case you want to do that with a GridHyperLinkColumn, you can use the following approach:
JavaScript:
That should do the trick. Please give it a try and let us know about the result.
All the best,
Eyup
the Telerik team
I suppose you are using the following example for reference:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandmenu/defaultcs.aspx?product=grid
In this case, please verify that you have removed the second part of the following condition, since the HyperLink generates an anchor element:
if (evt.target.tagName == "INPUT" || evt.target.tagName == "A"){ return;}Alternatively, you can use a GridTemplateColumn with asp:HyperLinks in its ItemTemplate and attach the oncontextmenu client side event handler. In case you want to do that with a GridHyperLinkColumn, you can use the following approach:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e){ if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; HyperLink hyperLink = dataItem["HyperLinkColumnName"].Controls[0] as HyperLink; hyperLink.Attributes.Add("oncontextmenu", "openHyperLinkMenu(this,event);"); }}function openHyperLinkMenu(hyperLink, event) { var menu = $find("<%=RadContextMenu1.ClientID %>"); menu.show(event);}That should do the trick. Please give it a try and let us know about the result.
All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
