I need the ability to show the customizationwindow when the user right-clicks on the column header row. While there's a straight-forward video to do exactly that, i still need the default built-in contextmenu of the browser, whenever the user clicks on other rows. This would match to the default ASPxPivotGrid behavior.
Unfortunately, the GridView produces ClientSideScripts.ContextMenu JavaScript-code in all areas with a return false statement, ex:
aspxGVContextMenu('ctl00_Content_ASPxGridView1','header',0,event); return false;
aspxGVContextMenu('ctl00_Content_ASPxGridView1','row',0,event); return false;
so the browsers contextmenu is disabled in all occasions, regardless what I filter upon in my own javascript.
function gridView_ContextMenu(s, e) {
if (e.objectType != 'header') {
if (gridView.IsCustomizationWindowVisible())
gridView.HideCustomizationWindow();
return true; // gets disregarded
}
gridView.ShowCustomizationWindow();
return false; // gets disregarded
}
A sledge-hammer approach would be to throw an error in my code to stop further execution. But that could not be the one and only option after all.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Rainer,
It is possible to remove a handler for the datarow's oncontextmenu event using the following code within the HtmlRowPrepared event handler:
protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if(e.RowType == GridViewRowType.Data) e.Row.Attributes.Remove("oncontextmenu"); }
I have also attached a sample project for you.
Thanks,
Plato
Works perfectly