Is there a way to set onmouseover for a LinkButton in ASP.NET 2.0 ?

R

Roberto Kohler

Is there a way within ASP.NET 2.0 to set the onmouseover property of a
LinkButton so that when the user hovers over the LinkButton, the windows
status bar displays some text instead of the javascript command ?

I'd like to do something like:
<asp:LinkButton ID="LinkEdit" Runat="server" CommandName="Edit">
onMouseOver="LinkButton_onMouseOver ('Click here to Edit the Record')"
onMouseOut="LinkButton_onMouseOut"
</asp:LinkButton>

function LinkButton_onMouseOver (strStatus)
{ window.status=strStatus; return true; }

function LinkButton_onMouseOut ()
{ window.status=""; return true; }
 
N

Nathan Sokalski

I do not believe there is a built-in way to do this in ASP.NET, but a common
workaround is to use the Attributes collection. Use onMouseOver or
onMouseOut as the Key, and use the script you want to be run as the Value.
For example:

LinkEdit.Attributes.Add("onMouseOut","window.status=''; return true;")

If you would prefer to use functions define the functions inside script tags
in the .aspx file and do the following:

LinkEdit.Attributes.Add("onMouseOut","LinkButton_onMouseOut();")

Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,298
Latest member
ZenLeafCBDSupplement

Latest Threads

Top