Hi,
On an ASP.NET GridView, I have several LinkButton objects. I want to add the "onmouseover" event to the LinkButton so that I can perform a javascript task-- in particular, to rewrite the window.status message so it shows a more meaningful message than the layman-confusing javascript link message.
So how do I add this "onmouseover" event to the LinkButton? I'm stumped.
Thanks.
Robert
I can't remember if you are coding in C# or VB.NET.
One way to solve this would be to implement the ITemplate class to customize a Template to be used for your GridView. If you don't have the time to learn how to do this...
In your GridView's RowDataBound event you can set the LinkButton's onmouseover event.....
-
Dim lbtnAs LinkButton
-
'if the row is a data row, grab the link button and set it's properties
-
If e.Row.RowType = DataControlRowType.DataRow Then
-
'The CType() method casts the object retrieved by the FindControl to a LinkButton object
-
lbtnAs = CType(e.Row.FindControl("theLinkButtonControlName"),LinkButton)
-
'As long as a LinkButton was returned...set the JavaScript
-
If Not lbtnAs Is Nothing Then
-
lbtnAs .Attributes.Add("onmouseover", "javascript:myJavaScriptFunction()")
-
End If
-
End If
-
Don't forget that LinkButtons have ToolTips...you could just set the LinkButton's ToolTip property to display additional information about said LinkButton instead ...
-
Dim lbtnAs LinkButton
-
'if the row is a data row, grab the link button and set it's properties
-
If e.Row.RowType = DataControlRowType.DataRow Then
-
'The CType() method casts the object retrieved by the FindControl method into a LinkButton
-
lbtnAs = CType(e.Row.FindControl("theLinkButtonControlName"),LinkButton)
-
'As long as a LinkButton was returned...set the ToolTip
-
If Not lbtnAs Is Nothing Then
-
lbtn.ToolTip="Additional information that is displayed when moused over the link button"
-
End If
-
End If
-
Cheers!
-Frinny