Radmenu bottom page javascript

7 posts, 0 answers
  1. porlandi
    porlandi avatar
    4 posts
    Member since:
    Apr 2010

    Posted 03 Apr 2010 Link to this post

    Hi,
    Is there a way to remove the javascript code from the page's bottom since I don't need it?
    Thanks

    <script type="text/javascript">
    //<![CDATA[
    Sys.Application.initialize();
    Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadMenu, 
    {"_childListElementCssClass":null,"clientStateFieldID":"dnn_rm_RadMenu1_ClientState","collapseAnimation":"{\"duration\":450}","expandAnimation":"{\"duration\":450}","itemData":[{"groupSettings":{"flow":0,"expandDirection":0,"offsetX":0,"offsetY":0},"navigateUrl":"http://www.domainname.com/"},{"groupSettings":{"flow":0,"expandDirection":0,"offsetX":0,"offsetY":0},
    ..........]}, null, null, $get("dnn_rm_RadMenu1")); }); //]]></script>
  2. Dino
    Dino avatar
    11 posts
    Member since:
    Nov 2008

    Posted 15 Apr 2010 Link to this post

    Hi,

    I too would like to remove this!

    It's a LOT of code that gets generated there, and for SEO reasons, we have to be "economic" with our HTML code, otherwise we will get penalised...
  3. porlandi
    porlandi avatar
    4 posts
    Member since:
    Apr 2010

    Posted 18 Apr 2010 Link to this post

    Yep, that is the exact same reason I was thinking of. It would be nice to have a control's property that would disable this code insertion.
    Thanks
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 19 Apr 2010 Link to this post

    Hello porlandi,

    ASP.NET renders the $create statements for every ajax server control and this cannot be avoided.
    You can try with the MS Ajax Toolkit - you will encounter the same $create javascript on the page.

    Regards,
    Veskoni
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Dino
    Dino avatar
    11 posts
    Member since:
    Nov 2008

    Posted 19 Apr 2010 Link to this post

    Hi Veskoni,

    Thanks for clarifying that. I thought it might be for some such reason, and that's a shame. However, I still feel it's overkill in terms of code generated for a menu.

    For example, I've created similar functionality before whereby the HTML LI items are parsed by Javascript after the onload event, and javascript events attached to each item to carry out the right functionality. If the RadMenu was treated similarly, then you wouldn't need any of the Javascript at the bottom of the page (which repeats a lof of the stuff that's already in the HTML UL markup for the Menu!). You would simply have a Javascript object in a separate JS file that will actually be cached. Hence it'll also be faster to load!

    The other benefit is that search engines (and other entities) can cache the page, whereas with your approach it's a problem because the references to WebResource.axd can't be cached. Is this not why this would generated "Padding is invalid and cannot be removed." errors?

    Anyway, considering that the menu is likely to appear on EVERY page on a site, it's a shame that the code generated to drive it is not a lot "neater", I may have to resort to creating my own Javascript object for this...
  6. T. Tsonev
    Admin
    T. Tsonev avatar
    2815 posts

    Posted 20 Apr 2010 Link to this post

    Hi Dino,

    The RadMenu and other controls from the ASP.NET AJAX suite rely on having client-side objects for each control and item on the client to deliver rich client-side functionality. The items must be serialized as JSON or loaded from a Web Service, but they must be there and there's no way to turn this off. We've tried to optimize this as much as we could and values that are rendered in the HTML are not serialized.

    If you want full control over the markup and lightweight client-side objects you might consider ASP.NET MVC and the Telerik Extensions for ASP.NET MVC.

    The "Padding is invalid and cannot be removed" error is occurring in the WebResource.axd handler which is part of ASP.NET and is not specific to Telerik controls. You can avoid this problem by setting a permanent machine key as described in this blog post.

    Another option is to load the control scripts and skins from the Telerik CDN. In this case the scripts and skins are served directly and not through a handler. It's will also reduce latencies for customers.

    I hope this helps.

    Kind regards,
    Tsvetomir Tsonev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. porlandi
    porlandi avatar
    4 posts
    Member since:
    Apr 2010

    Posted 23 Apr 2010 Link to this post

    Hi,
    Is it possible by using the Telerik MVC Menu to get the CSS classes for the first/last item in the menu and the CSS classes for the selected items in a easy way? Is there any web resources on that topic?

    Thanks
Back to Top