Rank: Advanced Member
Groups: Guest
Joined: 9/6/2005(UTC) Posts: 106
|
Dmity or Fedor,
I have another issue with the AJAX control. I am including a sample project for your reference. I have to be able to disable the right click on a web page. I have two exact forms one using the ajax control the other the web control. The ajax control does not work as expected. Right click on each form to see the results.
Thanks in advance
Chris
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hello Chris, AJAX controls display image in separate frame, that's why onmousedown event doesn't reach your code. You can use following code as workaround : Code:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AJAX.aspx.cs" Inherits="AJAX" %>
<%@ Register assembly="Aurigma.GraphicsMill.AjaxControls" namespace="Aurigma.GraphicsMill.AjaxControls" tagprefix="aur" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AJAX Control Page</title>
<script type="text/javascript" language="Javascript">
var Err = "Right click is disabled!";
function disableRightClick(btnClick){
if (navigator.appName == "Netscape" && btnClick.which == 3){
alert(Err);
return false;
}
else if (navigator.appName =="Microsoft Internet Explorer" && event.button == 2){
alert(Err);
return false;
}
}
document.onmousedown = disableRightClick;
function Application_load(){
window.frames["BitmapViewer2"].document.onmousedown = disableRightClick
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<aur:PanNavigator ID="PanNavigator1" runat="server"></aur:PanNavigator>
<aur:BitmapViewer id="BitmapViewer2" runat="server" MaxZoom="8" MinZoom="0.1"
ZoomQuality="High" ZoomMode="FitToWidth"
BrowserJpegQuality="30" BrowserImageFormat="Png" BorderStyle="Solid"
BorderWidth="1px" BackColor="White" ScrollBarsStyle="Auto"
Width="1014px" style="left: 0px; position: absolute; top: 0px; height: 349px;"
PreviewImageResizeRatio="1" BorderColor="GradientInactiveCaption"
Navigator="PanNavigator1" EnableViewState="False"
PreviewImageEnabled="False" Height="642px">
</aur:BitmapViewer>
<script type="text/javascript">
Sys.Application.add_load(Application_load);
</script>
</div>
</form>
</body>
</html>
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/6/2005(UTC) Posts: 106
|
I coped the code you sent in this and was unable to make it work for some reason? Any ideas?
Thanks in advance
Chris
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Quote:I coped the code you sent in this and was unable to make it work for some reason? Any ideas? Chris, what exactly error have you received? The idea of my code sample is to get direct access to IFrame and so listen events coming from it. Here is the key line of my sample: Code:function Application_load(){
window.frames["BitmapViewer2"].document.onmousedown = disableRightClick
}
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/6/2005(UTC) Posts: 106
|
I copied the entire code section into a project and tried to run it. I get a java script error that says object required. Can you run this in a project?
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hello Chris, Quote:I copied the entire code section into a pr oject and tried to run it. I get a java script error that says object required. Can you run this in a project? I am sorry, I have checked in FireFox only. Here is modified disableRightClick function: Code: function disableRightClick(btnClick){
if (navigator.appName == "Netscape" && btnClick.which == 3){
alert(Err);
return false;
}
else
{
var e = event ? event : window.frames["BitmapViewer2"].event;
if (navigator.appName =="Microsoft Internet Explorer" && e.button == 2){
alert(Err);
return false;
}
}
}
Edited by user Saturday, May 2, 2009 1:18:24 AM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/6/2005(UTC) Posts: 106
|
I copied this function line for line and it does not work with internet explorer. I am at a loss here. I have to be doing something wrong. And I am blind not to see it it? Do you have w working project that you can attach?
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/6/2005(UTC) Posts: 106
|
Fedor,
Thank you for being so patient with me over this. I forgot that we had addition code that we had talked about in addition to changing the right click function as well. It works like expected now. I really appreciate your help.
Thanks
Chris
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.