Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. disabling gridview

disabling gridview

Scheduled Pinned Locked Moved C#
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E eyeseetee

    Does any1 know if its possible to disable gridview so no1 can click on it and copy the text, i.e. its totally disabled cheers

    U Offline
    U Offline
    Ujjaval Modi
    wrote on last edited by
    #2

    Hi, Just set the gridview's Enabled property to "False", i.e. GridView.Enabled=False

    Regards, Ujjaval Modi :) Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.

    E 1 Reply Last reply
    0
    • U Ujjaval Modi

      Hi, Just set the gridview's Enabled property to "False", i.e. GridView.Enabled=False

      Regards, Ujjaval Modi :) Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #3

      this doesnt stop someone right clicking on the text and copying it, this is what i need for them not to be able to right click and copy the text any ideas?

      J 1 Reply Last reply
      0
      • E eyeseetee

        this doesnt stop someone right clicking on the text and copying it, this is what i need for them not to be able to right click and copy the text any ideas?

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #4

        <asp:gridview visible="false"> Im afraid thats about your only choice. Im afraid that putting something on the internet makes it highlightable, right-click-able, view-sourceable or printable. There is no sure fire way of stopping any of these methods of copying the page short of making it invisible or not putting it on the internet to start with.

        modified on Friday, December 21, 2007 5:53:36 AM

        E 1 Reply Last reply
        0
        • J J4amieC

          <asp:gridview visible="false"> Im afraid thats about your only choice. Im afraid that putting something on the internet makes it highlightable, right-click-able, view-sourceable or printable. There is no sure fire way of stopping any of these methods of copying the page short of making it invisible or not putting it on the internet to start with.

          modified on Friday, December 21, 2007 5:53:36 AM

          E Offline
          E Offline
          eyeseetee
          wrote on last edited by
          #5

          ah i thought i had seen it somewhere before where you couldn't copy text never mind thanks anyway

          D 1 Reply Last reply
          0
          • E eyeseetee

            ah i thought i had seen it somewhere before where you couldn't copy text never mind thanks anyway

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #6

            You can do it with some javascript, BUT that will work only against totally non-tech users. Anyone who know how to disable javascript or view page source in browser will be able to steal whatever you send to client.


            [My Blog]
            "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
            "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

            E 1 Reply Last reply
            0
            • D DavidNohejl

              You can do it with some javascript, BUT that will work only against totally non-tech users. Anyone who know how to disable javascript or view page source in browser will be able to steal whatever you send to client.


              [My Blog]
              "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
              "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

              E Offline
              E Offline
              eyeseetee
              wrote on last edited by
              #7

              ive actually find some javascript now is there an equilivant of onkeydown for asp.net gridview? cheers

              E 1 Reply Last reply
              0
              • E eyeseetee

                ive actually find some javascript now is there an equilivant of onkeydown for asp.net gridview? cheers

                E Offline
                E Offline
                eyeseetee
                wrote on last edited by
                #8

                ive managed to find some javascript which stops then right clicking on it but I need something that also stops them from ctrl c as well any1 know? thanks

                R 1 Reply Last reply
                0
                • E eyeseetee

                  ive managed to find some javascript which stops then right clicking on it but I need something that also stops them from ctrl c as well any1 know? thanks

                  R Offline
                  R Offline
                  Raheem MA
                  wrote on last edited by
                  #9

                  Can you please tell how to stop the users to copy the text using right click on it? Thanks in Advance SMARTech :)

                  E 2 Replies Last reply
                  0
                  • R Raheem MA

                    Can you please tell how to stop the users to copy the text using right click on it? Thanks in Advance SMARTech :)

                    E Offline
                    E Offline
                    eyeseetee
                    wrote on last edited by
                    #10

                    there you go: document.oncontextmenu = function() { return false; } if ( document.layers ) { window.captureEvents(Event.MOUSEDOWN); window.onmousedown = function(e) { if ( e.target == document ) return false; } } else { document.onmousedown = function() { return false; } } // -->

                    J 1 Reply Last reply
                    0
                    • R Raheem MA

                      Can you please tell how to stop the users to copy the text using right click on it? Thanks in Advance SMARTech :)

                      E Offline
                      E Offline
                      eyeseetee
                      wrote on last edited by
                      #11

                      there you go: document.oncontextmenu = function() { return false; } if ( document.layers ) { window.captureEvents(Event.MOUSEDOWN); window.onmousedown = function(e) { if ( e.target == document ) return false; } } else { document.onmousedown = function() { return false; } } // -->

                      1 Reply Last reply
                      0
                      • E eyeseetee

                        there you go: document.oncontextmenu = function() { return false; } if ( document.layers ) { window.captureEvents(Event.MOUSEDOWN); window.onmousedown = function(e) { if ( e.target == document ) return false; } } else { document.onmousedown = function() { return false; } } // -->

                        J Offline
                        J Offline
                        J4amieC
                        wrote on last edited by
                        #12

                        how about ctrl+a to select all then ctrl+c to copy or, view source and copy it all from there. You will never ever stop someone dedicated to copying the text froma web browser, the best you will achieve is hindering the non-techy.

                        E 1 Reply Last reply
                        0
                        • J J4amieC

                          how about ctrl+a to select all then ctrl+c to copy or, view source and copy it all from there. You will never ever stop someone dedicated to copying the text froma web browser, the best you will achieve is hindering the non-techy.

                          E Offline
                          E Offline
                          eyeseetee
                          wrote on last edited by
                          #13

                          there must be a way of stopping some using ctrl c and a how bout the below code i jus need to integrate it into asp.net do you know how i could put on key down for asp.net? function noCopyKey(e) { var forbiddenKeys = new Array('c','x','v'); var keyCode = (e.keyCode) ? e.keyCode : e.which; var isCtrl; if(window.event) isCtrl = e.ctrlKey else isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false; if(isCtrl) { for(i = 0; i < forbiddenKeys.length; i++) { if(forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) { alert('You are prompted to type this twice for a reason!'); return false; } } } return true; }

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups