Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LoginButton.Click
        con.Open()
        cmd.Connection = con
        cmd.Parameters.Add(New SqlClient.SqlParameter("@userName", txtUsername.Text))
        cmd.Parameters.Add(New SqlClient.SqlParameter("@password", txtPassword.Text))
        cmd.CommandText = "SELECT userName,password FROM signUp WHERE userName =@userName AND password =@password COLLATE Latin1_General_CS_AS "

        Dim str As String = cmd.ExecuteScalar
        If str = "" Then
            lblMessage.Visible = True
            txtUsername.Text = ""
        Else
            Response.Redirect("WebForm2.aspx")
        End If
        con.Close()
    End Sub

i wants to
lblMessage.Visible = false
on key press
Posted
Updated 12-Feb-14 17:27pm
v2

try this:-
XML
<script language="javascript" type="text/javascript">
    function hideIt() {
        document.getElementById('<%=myLabel.ClientID%>').style.display = 'none';
    }
</script>

and call from any control as onkeypress="hideLabel()":-
<asp:TextBox ID="txtEmailAddress" runat="server" Width="200px" CssClass="customtxt" onkeypress="hideLabel()"></asp:TextBox>

Refer:-
http://api.jquery.com/keypress/[^]
 
Share this answer
 
v2
Comments
neeraj_ 13-Feb-14 1:15am    
there r not a key press event in asp
 
Share this answer
 
Comments
neeraj_ 12-Feb-14 23:55pm    
this not worked
i have solved

function hideLabel(sender, e) {
document.getElementById('<%=lblResult.ClientID%>').style.display = 'none';
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900