Auto scroll not working on RadPanelBar

4 posts, 0 answers
  1. Mohamed
    Mohamed avatar
    6 posts
    Member since:
    Nov 2010

    Posted 11 Nov 2010 Link to this post

    Hey,
    I have a left had side menu control that uses PanelBar, it maintains its state between postbacks by this javascript code:

    <script type="text/javascript">
        function pageLoad() {
            var currentUrl = window.location.href.toLowerCase();
            var panelbar = $find("<%= tlrkNavigationPanel.ClientID %>");

            var currentItem = null;
            var currentItemTemp = null;
            for (var i = 0; i < panelbar.get_allItems().length; i++) {
                if (panelbar.get_allItems()[i].get_linkElement() &&
                currentUrl.indexOf(panelbar.get_allItems()[i].get_linkElement().href.toLowerCase()) > -1) {
                    currentItem = panelbar.get_allItems()[i];
                    currentItemTemp = currentItem;
                    break;
                }
            }

            while (currentItem && currentItem.get_parent() != panelbar) {
                currentItem.get_parent().expand();
                currentItem = currentItem.get_parent();
            }

            if (currentItemTemp) {
                currentItemTemp.select();
                currentItemTemp.expand();
            }
        }    
    </script>

    After moving to the new page it highlights the selected item and expand the menu, but if the selected item is not visible because the menu height exceeds the visible range, I need to scroll to view the selected item. Can anyone tell me how to make it auto scroll to the selected item
    Thanks and best regards,
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 16 Nov 2010 Link to this post

    Hello Mohamed,

    Could you, please, try the following:
    panelItem.get_elememt().scrollIntoView();
    and let me know how that worked for you?

    I hope this will solve the problem!


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohamed
    Mohamed avatar
    6 posts
    Member since:
    Nov 2010

    Posted 20 Nov 2010 Link to this post

    Thanks Nikolay for your reply,
    I tried this solution but unfortunately it didn't work with me.
    Here is my code:

    if (currentItemTemp) {

                    currentItemTemp.select();
                    currentItemTemp.expand();
                    currentItemTemp.get_element().scrollIntoView();
                } 
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 25 Nov 2010 Link to this post

    Hi Mohamed,

    Can you try setting PersistStateInCookie="true" instead of using a javascript workaround?


    All the best,
    Peter
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top