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

Unable to override browser status as explained in doc

11 Answers 67 Views
Menu
This is a migrated thread and some comments may be shown as answers.
CSurieux
Top achievements
Rank 2
CSurieux asked on 26 Jul 2009, 02:33 PM
Hello,
I want to avoid displaying the navigateurl when mouse is over a menuitem (or RadPanelBarItem) and I try to use, as explained in doc the OnClientMouseOver and OnClientMouseOut
client messages to trigger a javascript displying the menuItem Text as

function OnClientMouseOver(panelbar, args)   
{  
    window.status  =   args.get_item().get_text();   

but it has no effect: still the href of anchor is displayed.
Is there some security trick  or a bug in my code ? when I insert alert, I really get correct text.

Notice that I think this should be an option for radMenu and RadPanelBar ?
Thanks for help.


CS

11 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 27 Jul 2009, 12:28 PM
Hi Christian,

Please find below a sample code snippet that shows the needed approach.

<form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadMenu ID="RadMenu1" runat="server"
        <Items> 
            <telerik:RadMenuItem runat="server" Text="Root RadMenuItem1" NavigateUrl="Default.aspx"
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1" NavigateUrl="Default.aspx"
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 2" NavigateUrl="Default.aspx"
                    </telerik:RadMenuItem> 
                </Items> 
            </telerik:RadMenuItem> 
        </Items> 
    </telerik:RadMenu> 
 
    <script type="text/javascript"
        $telerik.$('.rmLink').each(function(e) { 
            var text = $telerik.$(this).text(); 
            this.onmouseover = function() { window.status = text; return true; }; 
        }); 
    </script> 
 
    </form> 


All the best,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
CSurieux
Top achievements
Rank 2
answered on 27 Jul 2009, 02:13 PM
Hello Paul,

Thanks but the code you send seems subject to Telerik changing a deep code value like rmLink

 $telerik.$('.rmLink').each(function(e) { 
            var text = $telerik.$(this).text(); 
            this.onmouseover = function() { window.status = text; return true; }; 
        }); 

So thanks unless Telerik certify this value will not change in next years...

Why my approach is not working ? I respected all Telerik documentation and sucessufully receive the text value as I could se with alert ?
Problem seems to be in windows.status= 'something' in respect of browser version ?


Thanks
CS
0
Alex Gyoshev
Telerik team
answered on 27 Jul 2009, 02:41 PM
Hello Christian,

We certify that we do not intend to change the rmLink class name in the foreseeable future. It is safe to use the code sample.

The difference between the two approaches is that attaching the event through the OnClientMouseOver event, you do not cancel the browser-specific display of the links (e.g. the browser displays the href in the status bar, ignoring what you previously set in the handler).

Sincerely yours,
Alex
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
CSurieux
Top achievements
Rank 2
answered on 27 Jul 2009, 04:58 PM
Hello Alex,

So some thread on this subject has to be marked as obsoletes...

Other problem, is this javascript working if I get several radmenus on the page ?

Is add the attribute 'onmouseover' to my radmenuitems from codebehind a solution to avoid the javascript ?

Thanks for answer

CS
0
Atanas Korchev
Telerik team
answered on 27 Jul 2009, 05:13 PM
Hello Christian Surieux,

Could you please let us know where you found any references to window.status in our help? I tried looking in the documentation of RadMenu and RadPanelbar but I couldn't find any. We would like to update the help topic so it is not misleading other users.

Yes you can use that javascript with more than one menu on the page. Additionally you can use the "onmouseover" attribute however it would generate more output in your page. We recommend using the JavaScript solution.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
CSurieux
Top achievements
Rank 2
answered on 27 Jul 2009, 06:24 PM
Hello Albert,


Sorry, I browsed in my history and was unable ti find the forum where somebody from Telerik has replyed by the code implying OnClientMouseOver and OnClientMouseOut
and in the last documentation the OnclientMouveOver doesnt concern status but putting Menuitem text in a label.

Concerning javascript I have to face the problem of very slow client pages due to tons of javascript, and long to load pages due to tons of code...


Thanks
CS
0
CSurieux
Top achievements
Rank 2
answered on 28 Jul 2009, 02:09 PM
Hello Paul or Alber,

I am also trying to do this for RadPanelBar, I suppose that $telerik.$('.rmLink').each(function(e)  is only working for RadMenu? Is tehre something for RadPanelBar ?

Thanks

CS
0
Paul
Telerik team
answered on 28 Jul 2009, 02:27 PM
Hello Christian,

Frankly, I don't think your request has anything to do with any Telerik control.

The browser status bar is there to show status messages *from the browser*, not from the web page author. A web page is not the application, the browser is the application. The web page is the data.

This has been thrashed about endlessly in the developers newsgroups lately. The general consensus is that, when viewers hover over a link they sometimes look at the status bar to see where the link is going to send them to. If something other than a URL appears then they get suspicious and just don't go there.

In addition, the status bar manipulation is turned off by default (see attached screenshot), so the provided JS won't work.

Still, please find below the modified code snippet that will work with RadPanelBar.

<script type="text/javascript"
    $telerik.$('.rpLink').each(function(e) {  
        var text = $telerik.$(this).text();  
        this.onmouseover = function() { window.status = text; return true; };  
    });  
</script>  


Kind regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
CSurieux
Top achievements
Rank 2
answered on 28 Jul 2009, 03:32 PM
Hello Paul,

Thanks for all aspects of your answer.
I would say that it's cunfortable to have power to do it.
After we will decide what to do, but actually we use an url rewriter and even if the user is interested to see an url, it will not be the real thing.
How people could be sure that the displayed url is the real href ?

We prefer display the text of our menu, or better the tooltip message which is more detailled when existing.

But your right there is certainly tons of pages on the subject everywhere, it was the same for MDI last century :)

Personnaly I thing that browsers are reinventing the wheel, hundred of people have already spend time on UI, 3270 was quite good, Vax Messages and Wix very good :)

Anyway thanks.

CS
0
CSurieux
Top achievements
Rank 2
answered on 28 Jul 2009, 03:50 PM
Hello Paul,

Last small request: .Text is for Text, and for tooltip text ?

Thanks
0
Paul
Telerik team
answered on 31 Jul 2009, 11:40 AM
Hello Christian,

Here it is:

 <script type="text/javascript">  
    $telerik.$('.rpLink').each(function(e) {   
        var text = $telerik.$(this).attr("title")
        this.onmouseover = function() { window.status = text; return true; };   
    });   
</script> 


Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Menu
Asked by
CSurieux
Top achievements
Rank 2
Answers by
Paul
Telerik team
CSurieux
Top achievements
Rank 2
Alex Gyoshev
Telerik team
Atanas Korchev
Telerik team
Share this question
or