How to create key press event using javascript in asp.net with c#

Posted by Unknown On Friday, 4 October 2013 0 comments
Hi, in this post I describe that how to define the textbox keypress event using javascript in asp.net using c#.
For that you have to simple take one textbox and write the javascript function as follow.
I have give the whole design of page, in this nothing came in backend page coding.

<head>
<script type = "text/javascript" >
        function WriteName(id) {
            var temp = document.getElementById('<% = Label7.ClientID %>').style.visibility = "hidden";
        }
        function falselab(id) {
            var temp = document.getElementById('<% = Label4.ClientID %>').style.visibility = "hidden";
            
        }

        

    </script>

</head>

In form tag below code is come.
<asp:TextBox ID="TextBox1" runat="server" onkeypress="javascript:WriteName(this);" ></asp:TextBox>

0 comments:

Post a Comment