Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Friday, November 7, 2014

Asp.net C# page Disable right click by jquery

Disable right click by jquery in asp.net web Page:

Disable right click by jquery:

In this post we give example of Disable right click on asp.net web application. The right click protection is basically used to protect the page content. 

 Some time we can copy the text from the web page content but if you have   some important content and you want to disable copy then you can use the Right click disable in asp.net. There is type you can disable right click by JavaScript and by jquery.

    Here we give a Example of jquery with code that disable right click on page.How to disable right click on asp.net web page using Jquery

JavaScript function for disable right click on asp.net page:

<script type="text/javascript">
        $(function () {
            $(this).on("contextmenu"function () {
                return false;
            });
        });
</script>

Asp.net web page code:

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Rightclickdicable.aspx.cs" Inherits="Rightclickdicable" %>

<!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 id="Head1" runat="server">
        <title>Disable right click on web page using jQuery</title>
    <script Src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(this).on("contextmenu", function () {
                return false;
            });
        });
</script>

</head>

<body>

    <form id="form1" runat="server">
    <div>
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
    </div>
    </form>

</body>

1 comment:

  1. Great Article i have learned so many things from your article

    Please check this and tell me more about it:
    http://seowebsitedesigning.com/disable-mouse-right-click-using-jquery/

    ReplyDelete