This is a migrated thread and some comments may be shown as answers.
Postback only when Expand?
2 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 08 Sep 2009, 02:32 PM
Hi,

Is there a way to send a postback and do serverside code when the user expands the panel but no postback when the panel is collapsed. Now I use the event OnItemClick couse there are no OnExpand and OnCollapse but then there are allways a postback - no good.

On Expand I load stuff inside the panel but on collapse no such thing needs to be done.

/R

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 09 Sep 2009, 06:15 AM
Hi Raymond,

Try the following approach to achieve the functionality.

ASPX:
 
<telerik:RadPanelBar ID="RadPanelBar1" OnClientItemClicking="OnClientItemClicking" OnClientItemExpand="OnClientItemExpand" 
 runat="server" OnItemClick="RadPanelBar1_ItemClick"
</telerik:RadPanelBar> 

JavaScript:
 
<script type="text/javascript"
function OnClientItemExpand() 
    __doPostBack('<%= RadPanelBar1.ClientID %>'  , ''); 
function OnClientItemClicking(sender, args) 
    if(args.get_item().get_expanded()) 
    { 
        args.set_cancel(true); 
        args.get_item().set_expanded(false); 
    } 
</script> 

-Shinu.
0
Raymond
Top achievements
Rank 1
answered on 09 Sep 2009, 08:27 AM
Works great!

Thanks Shinu.

/R
Asked by
Raymond
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Raymond
Top achievements
Rank 1
Share this question
or