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

PanelBar - postback on expansion only

2 Answers 60 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Sphengle
Top achievements
Rank 1
Sphengle asked on 11 May 2010, 02:08 PM
I have a panel bar which is divided into sections.  Within each subsection there are RadPanelItems that are links to other pages.  One of the things I do is to put a number such as (59) next to the item text to indicate how many items will be listed when the user clicks on the link. 

With the aid of RadAjaxManager I am updating the links via an Ajax call when the section is expanded. i.e.I am hooking into the ItemOnclick event and updating the links in the expanded section.  However, an Ajax postback occurs when I contract the section as well - it is this postback that I want to avoid. 

Any suggestions on how to do this?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 14 May 2010, 12:02 PM
Hi Sphengle,

I suggest you subscribe to OnClientItemClicking event of the panelbar and disable the postback in its handler in case the item is about to collapse. Here is a sample code snippet:

<script type="text/javascript">
    function itemClicking(sender, args) {
        var item = args.get_item();
        if (item.get_level() == 0) {
            if (item.get_expanded() == true)
                item.set_postBack(false);
            else
                item.set_postBack(true);
        }
    }
</script>


All the best,
Yana
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.
0
Sphengle
Top achievements
Rank 1
answered on 14 May 2010, 01:46 PM
Excellent!  That's perfect.  Thank you very much.
Tags
PanelBar
Asked by
Sphengle
Top achievements
Rank 1
Answers by
Yana
Telerik team
Sphengle
Top achievements
Rank 1
Share this question
or