Disable copy paste in textbox asp.net

Filed in .Net | Javascript Leave a comment

<asp:TextBox ID=”txtEmailAddress2″ runat=”server” MaxLength=”50″ oncut=”return false;” onpaste=”return false;” oncopy=”return false;” onkeydown=”return disableCtrlKeyCombination(event);”></asp:TextBox>

<script type=”text/javascript”>

function disableCtrlKeyCombination(e) {

key = e.which;     //firefox

if (e.ctrlKey) {

return false;

}

}

</script>

Getting values from label, hiddenfield in javascript for IE, Firefox

Filed in .Net | Javascript Leave a comment

var tot;

//Get cialis super active controls as below

var subTotals = document.getElementById(‘<%= lblSubTotals.ClientID %>’);

var promocodetype = document.getElementById(‘<%= hdnPromoCodeType.ClientID %>’);

if (document.all) {//IE

var pc = promocodetype.value;

tot = subTotals.innerText;

}

else{//Fire Fox

tot = subTotals.textContent;

}

TOP