.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> JavaScript/VBScript >> Post New QuestionBookmark and Share Subscribe to Forum

textbox text values should not be copied or edited

Posted By: Jayakumar     Posted Date: February 17, 2010    Points:2   Category :JavaScript/VBScript

my textboxes text values should be copied or modified how it can be down.

im using asp.net 3.5

Author: Lalij Mer          Accepted Answer   
Posted Date: February 17, 2010     Points: 10   
Author: Amit Mehra          Accepted Answer   
Posted Date: February 17, 2010     Points: 10   


To Disable copy paste option you can paste this code in your textbox

oncontextmenu="return false;" onselectstart="return false;" 

and to make your textbox read only set ReadyOnly Property of the TextBox to true

like this

 <asp:TextBox ID="TextBox1" runat="server" ReadOnly="true" oncontextmenu="return false;" onselectstart="return false;"></asp:TextBox>

Please "Mark As Answer " if this post help you.
Author: karthi          Accepted Answer   
Posted Date: February 18, 2010     Points: 10   

just use

<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged" oncopy="return false" onpaste="retun false" oncut="return false" ></asp:TextBox>

here while typing oncopy or onpaste or oncut no intellisense will occur.,, . just type it.,, and in .htm file it will show options for copy,cut and paste . but you cant do it.

i tried it . it worked well and posted this..

Author: jay             
Posted Date: February 18, 2010     Points: 5   

u assign that textbox value to a stringbuilder than u can modify as u want using inbuilt functins.
now use sb for changing.

Author: abhay             
Posted Date: March 04, 2010     Points: 5   

<input type=text oncopy="return false;" oncut="return false;" onpaste="return false;" id=txtx runat=server />

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend