Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > PanelBar > Getting reference to RadPanelBar in IE

Not answered Getting reference to RadPanelBar in IE

Feed from this thread
  • Amir avatar

    Posted on Sep 18, 2010 (permalink)

    Hi,
    I have a radpanelbar with PersistStateInCookie="True". It's is populated dynamically in code behind. I want to write a javascript code to check if there is no level 0 item expanded then it expands the last level 0 item. I have written the following code:
    function ExpandFirst() {
        var panelBar = $find("<%= _radpnlbarMenu.ClientID %>");
        if (panelBar) {
            var item = panelBar.get_expandedItem();
            if (panelBar.get_expandedItem() == null) {
                var items = panelBar.get_items();
                if (items.get_count() > 0)
                    items.getItem(items.get_count() - 1).expand();
            }
        }
    }
     
    $(document).ready(function() {
        ExpandFirst();
    });



    <telerik:RadPanelBar OnItemDataBound="RadpnlbarMenuOnItemDataBound" runat="server" ID="_radpnlbarMenu" ExpandAnimation-Type="InQuart" ExpandAnimation-Duration="500" CollapseAnimation-Duration="500" CollapseAnimation-Type="InQuart" Height="250px" ExpandMode="FullExpandedItem" PersistStateInCookie="True">
        <DataBindings>
            <telerik:RadPanelItemBinding Depth="0" Expanded="true" />
        </DataBindings>
    </telerik:RadPanelBar>

    It works fine in Firefox but in IE the panelBar object is always null.
    Is this the best way to do the trick?
    Can you please help me?

    Reply

  • Cori Master avatar

    Posted on Sep 22, 2010 (permalink)

    Hello Amir,

    I would suggest calling the ExpandFirst method in the RadPanelBar's OnClientLoaded event, instead on ready. The reason for that is the ready event is called when the DOM is fully loaded, but since RadPanelBar's jQuery object isn't fully created before that event is raised it will return a null reference.

    Another option would be to add it like this:

    Sys.Application.add_load(ExpandFirst);

    Both approaches ensure that the RadPanelBar object has been created before trying to get a reference to it.

    I hope that helps.

    Reply

  • Nikolay Tsenkov Nikolay Tsenkov admin's avatar

    Posted on Sep 27, 2010 (permalink)

    Hi Cori,

    Could you, please, try executing ExpandFirst on the ClientLoad event?
    Here is a help article for this client event of RadPanelBar: http://www.telerik.com/help/aspnet-ajax/panel_panelbar_onclientload.html

    Hope this is going to help you!


    Regards,
    Nikolay Tsenkov
    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

    Reply

  • Neerajan avatar

    Posted on Dec 26, 2011 (permalink)

     Hello,

    I also have the same issue but in my case i have to use RadPane  this doesnt have OnClientLoaded  function.
    Also, I need to call a method from another js file from this function. I tried using 

    function Expand(){
    var pane="<%= RadPane.ClientID%>"
    if(pane.IsLocked()){
    var splitter=pane.get_splitter();
            abc.ShowPane(splitter); // it is a method in another js file.
    }
    }
    Sys.Application.add_load(Expand());

    The isLocked() and get_splitter() are not accessible from the method Expand().
    How can i resolve the same issue?

    Thanks,
    Neerajan

    Reply

  • Kate Kate admin's avatar

    Posted on Dec 28, 2011 (permalink)

    Hi Neerajan,

    Please refer to Cori's post and use  Sys.Application.add_load(Expand); instead of Sys.Application.add_load(Expand());

    Further to be able to understand your scenario and help you out accessing the isLocked() and get_splitter() properties I would like to ask you to elaborate a bit on your case. For instance a simplified runnable page or just the markup demonstrating how you use the RadSplitter control would be very useful to us.

    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > PanelBar > Getting reference to RadPanelBar in IE
Related resources for "Getting reference to RadPanelBar in IE"

[  ASP.NET PanelBar Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]