Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have an label named label 4 I want to write an MouseOver event in my c# which is an web application.
C#
protected void Label4_MouseOver(object sender, EventArgs e)
{
    Label4.Visible = false;
}

Here is my code its not working please say me the problem
Posted
Updated 10-May-17 4:57am
v3

In web, you should use client side event.

Try:
C#
Label4.Attributes.Add("onmouseover","SomeJavaScriptFunction();");

This line would add a client side event to mouse over of the label. You can write your logic on mouse over in this method.
 
Share this answer
 
Try this:
.aspx file:
ASP.NET
<Script type="Javascript">
function visible()
{
    document.getElementById("Label4").visible = false;
}
</script>
 <asp:label id="Label1" runat="server" text="Hiiii Prashant" onmouseover="visible();"></asp:label>
 <asp:label id="Label4" runat="server" text="Hiiii Prashant"></asp:label>
 
Share this answer
 
v2

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