I have a custom textbox control with extends the TextBox APS.NET class. It is built such that on right click a calendar opens. So far so good, but in Firefox the default context menu opens over my calendar control, like here:
. I was wondering how can I disable this Firefox content menu and prevent it from appearing.I have tried setting in JavaScript document.oncontextmenu = function() {return false;} but this will disable all context menus on my page. My code for opening the calendar inside this control is:
if (isDate) // check if it's a date textbox where the calendar should be displayed on right click
{
this.Attributes.Add("oncontextmenu", "javascript:ShowCalendar(this);");
}
I think it I need to set it here somehow to prevent the other context menu from opening, but I am not sure how. Any advice much appreciated.
Found the solution to this. I should have called event.stop() to prevent the context menu appearing over my calendar.
this.Attributes.Add("oncontextmenu", "javascript:if(event.stop) {event.stop();} ShowCalendar(this);");
Thanks anyway!