I attach in my ASP.NET app to a cell oncontextmenu
a function string.Format("OnCellContextMenu({0}, '{1}', true, true)", e.VisibleIndex, e.DataColumn.FieldName).
In my JS i define the following function.
function OnCellContextMenu(visibleIndex, fieldName, hasNote, hasValue) {
currentVisibleIndex = visibleIndex;
currentFieldName = fieldName;
if (fieldName == "Name" || fieldName == "TOTAL") {
EnableMenuItem('AddNote', false);
EnableMenuItem('EditNote', false);
EnableMenuItem('RemoveNote', false);
}
else {
EnableMenuItem('AddNote', !hasNote && hasValue);
EnableMenuItem('EditNote', hasNote);
EnableMenuItem('RemoveNote', hasNote);
}
window.event.returnValue = false;
gvPrevisions.SetFocusedRowIndex(visibleIndex);
GridMenu.ShowAtPos(ASPxClientUtils.GetEventX(event), ASPxClientUtils.GetEventY(event));
}
Now, on IE works properlly, but on Firefox window.event.returnValue = false;
it is not executed. I googled around to see how the Firefox treats this return value and I got that I should call e.preventDefault(); insdead of window.event. The problem is that in my function e is undefined.
Can you please help me finding a solution that works both on FF and IE?
Thanks
I found my way out.
I declared a function in this way:
and the association in this way:
then in the function I got
var currentEvent = (window.event) ? window.event : e;and used
currentEventacross other function calls likeASPxClientUtils.PreventEventAndBubble(currentEvent);Cheers