This is a migrated thread and some comments may be shown as answers.

MOuseOver and MouseOut

2 Answers 95 Views
Menu
This is a migrated thread and some comments may be shown as answers.
VS
Top achievements
Rank 1
VS asked on 12 Aug 2008, 06:30 AM
Hi,

I am trying to change the backcolor and forecolor on mouseover and mouseout events. But it throws javascript error for LinkElement.
I had done the same for RadMenu for ASP.Net and its working fine. But this is not working for AJAX Menu.

The error shown is Item.LinkElement is null or not an object

Note:- Why am not using css for this is coz i will be knowing the colors only at runtime.

<script language="javascript" type="text/javascript">
    var oldItemForeColor = "";
    var oldItemBGColor = "";
         
    function clientMouseOver(sender, eventArgs) 
    { 
        var linkElement = eventArgs.Item.LinkElement; 
         
        oldItemForeColor = linkElement.style.color;
        oldItemBGColor = linkElement.style.backgroundColor; 
         
        linkElement.style.color = "<%= MenuBackColor%>";
        linkElement.style.backgroundColor = "<%= MenuForeColor%>";
    } 
     
    function clientMouseOut(sender, eventArgs) 
    {  
        var linkElement = eventArgs.Item.LinkElement; 
         
        linkElement.style.color = oldItemForeColor;
        linkElement.style.backgroundColor = oldItemBGColor;
    }
</script>

Please help.

Thanks & Regards

Sujith

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 12 Aug 2008, 07:15 AM
Hello Sujith,

It seems you are still using the client-side API for the "classic" RadMenu.
RadMenu for ASP.NET AJAX has different client-side API and you can check these articles on the subject:

In your case, you need to replace this line:

var linkElement = eventArgs.Item.LinkElement; 

with this one:

var linkElement = eventArgs.get_item().get_linkElement(); 

I hope this helps.

Greetings,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
VS
Top achievements
Rank 1
answered on 12 Aug 2008, 11:13 AM
Hi Veskoni,

Thanks. Its working now.

Regards

Sujith
Tags
Menu
Asked by
VS
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
VS
Top achievements
Rank 1
Share this question
or