Tuesday 21 May 2013

Widgets

Right Click Disable On Picture and Page In Asp.net

Demo:-


Code:-

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Restrict Right Click</title>
   
    <script type="text/javascript">
function disableRightClick()
{
alert("Right Click not Allowed !!");
return false;
}
</script>
   
</head>
<body oncontextmenu=" return disableRightClick();">
    <form id="form1" runat="server">
    <div>
    <asp:Image ID="img1" runat="server" ImageUrl="~/1.jpeg" Width="261px"
            oncontextmenu="return false;" Height="214px" />
   
    </div>
    </form>
</body>
</html>



0 comments:

Post a Comment