This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Chris Herrington  
#1 Posted : Wednesday, April 29, 2009 3:14:14 AM(UTC)
Chris Herrington

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
Fedor  
#2 Posted : Thursday, April 30, 2009 3:02:04 PM(UTC)
Fedor

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
Chris Herrington  
#3 Posted : Thursday, April 30, 2009 8:35:48 PM(UTC)
Chris Herrington

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
Fedor  
#4 Posted : Friday, May 1, 2009 1:22:53 AM(UTC)
Fedor

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
Chris Herrington  
#5 Posted : Friday, May 1, 2009 4:34:30 AM(UTC)
Chris Herrington

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
Fedor  
#6 Posted : Saturday, May 2, 2009 1:17:46 AM(UTC)
Fedor

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
Chris Herrington  
#7 Posted : Saturday, May 2, 2009 2:01:02 AM(UTC)
Chris Herrington

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
Chris Herrington  
#8 Posted : Saturday, May 2, 2009 2:15:21 AM(UTC)
Chris Herrington

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
Users browsing this topic
Guest (4)
Similar Topics
Ajax Controls and Vector Objects and AJAX Control Toolkit (Discussions – Graphics Mill)
by NormanL 5/14/2012 9:20:02 AM(UTC)
Overlaying images and ajax controls (Discussions – Graphics Mill)
by NormanL 5/8/2012 1:23:50 AM(UTC)
Ajax ImageVObject Border create hairline (Discussions – Graphics Mill)
by ChingYen 11/14/2010 5:46:35 PM(UTC)
AJAX MultilayerViewer does not work on IE 9.0? (Discussions – Graphics Mill)
by ChingYen 11/11/2010 1:03:10 AM(UTC)
AJAX (Discussions – Graphics Mill)
by Chris Herrington 4/28/2009 6:21:04 AM(UTC)
AJAX Sample Project (Discussions – Graphics Mill)
by Chris Herrington 4/28/2009 12:38:02 AM(UTC)
TIFF image rotation with Ajax BitmapViewer (Discussions – Graphics Mill)
by b.de.vries 11/26/2008 11:37:32 PM(UTC)
HOWTO: Create Overview-Window for AJAX BitmapViewer (Samples – Graphics Mill)
by Alex Kon 3/27/2008 2:43:14 PM(UTC)
PRB: AJAX and Web Controls Do Not Work on Production Site when You Publish It Using Visual Studio (FAQ – Graphics Mill)
by Dmitry 2/1/2008 2:41:01 PM(UTC)
AjaxControls Access Denied (Discussions – Graphics Mill)
by John Thelen 11/21/2007 4:33:20 AM(UTC)
Problem with rubberband not found on postbacks/ajax actions (Discussions – Graphics Mill)
by Stefan Haupt 10/24/2007 3:35:35 PM(UTC)
AJAX (Discussions – Graphics Mill)
by natebell 7/6/2007 12:18:32 AM(UTC)
AJAX approach with Web Controls and Image Uploader (Discussions – Graphics Mill)
by Fedor 7/24/2006 1:56:31 AM(UTC)
AJAX compatability? (Discussions – Graphics Mill)
by jcavaliere 11/1/2005 1:03:45 AM(UTC)
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.