Hi alhakimyyes,
Check the below example.
HTML
<asp:TextBox ID="txtId" runat="server"></asp:TextBox>
<script type="text/javascript">
window.onload = function () {
var txt = document.getElementById('<%=txtId.ClientID%>');
txt.setAttribute("autocomplete", "off");
txt.setAttribute("onkeypress", "KeyPress(event)");
txt.setAttribute("onpaste", "Paste(event)");
}
function KeyPress(e) {
alert('key pressed');
}
function Paste(e) {
e.preventDefault();
}
</script>