+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / SF 3.5 - RadPanelBar issue

SF 3.5 - RadPanelBar issue

3 posts, 0 answered
  1. Chris
    Chris avatar
    57 posts
    Registered:
    12 Nov 2008
    04 Dec 2008
    Link to this post
    Hi,

    When using the RadPanelBar (SiteFinity 3.5 Community) without using the embedded scripts, I get JavaScript errors (tested in IE6, IE7 and Firefox 3).
    This is because there is still a JavaScript added to the end of the page that contains skin and animation configurations as well as information about expanded and selected sites in the navigation.

    This script fails because the variables it tries to set do not exist. It actually should not be included in the page at all (embedded scripts are disabled).

    Is there any fix for that issue?

    Cheers, Chris
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    05 Dec 2008
    Link to this post
    Hi Chris,

    If you set EnableEmbeddedScripts property to false, you need to to add a script reference for each JavaScript file through the ScriptManager. Note that JavaScript files are necessary for the proper functioning of the RadControls. For details on this matter please refer to the following article : Disabling embedded resources

    Do let us know if you need any further assistance.

    Sincerely yours,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Chris
    Chris avatar
    57 posts
    Registered:
    12 Nov 2008
    05 Dec 2008
    Link to this post
    Thanks for the link! I had a different understanding of what disabling the scripts would do.

    The main reason why I wanted to disable the script completely was that I have a fixed width navigation area. Since I padded the 2nd and 3rd level navigation lists, the inline "width: 100%" that gets added to the <ul> tags just broke my design (long entries were jumping out of the navigation area, instead of being wrapped). I am now overwriting that with fixed widths and the "!important" statement in my stylesheet. Is there any reason for adding the inline "style="display: block; width: 100%;" " attribute? The same functionality could easily be achieved by an external (maybe embedded?) stylesheet.

    The website I'm working on must also be able to work if JavaScript is disabled. Unfortunately, the CSS classes that mark expanded and selected entries are only added by the JavaScript. I modified the SidePanelBar with the following code (in the Page_Load method):
    string currentUrl = UrlHelper.ResolveUrl(urlContext.Path); 
    RadPanelItem parentItem; 
    foreach (RadPanelItem item in RpbNavigation.GetAllItems()) 
        if (currentUrl.Equals(item.ResolveUrl(item.NavigateUrl), StringComparison.OrdinalIgnoreCase))  //currently selected item 
        { 
            item.Selected = true
            item.CssClass += ((0 == item.CssClass.Length) ? "" : " ") + item.SelectedCssClass; 
            if (0 < item.Items.Count)  //item has children --> expand 
            { 
                item.Expanded = true
                item.CssClass += ((0 == item.CssClass.Length) ? "" : " ") + item.ExpandedCssClass; 
            } 
            item.ExpandParentItems();  //expand parent items to show tree 
            parentItem = item; 
            while (null != parentItem.Owner && parentItem.Owner.GetType() == typeof(RadPanelItem))  //set parent item css classes 
            { 
                parentItem = parentItem.Owner as RadPanelItem; 
                parentItem.CssClass += ((0 == parentItem.CssClass.Length) ? "" : " ") + parentItem.ExpandedCssClass; 
            } 
        } 
        if (!item.Expanded)  //delete all items that are not expanded. This does not affect the top level 
        { 
            item.Items.Clear(); 
        } 
     
    This way, I get an (almost fully) functional menu even if JavaScript is disabled.

    Cheers, Chris
Register for webinar
3 posts, 0 answered