Postback only when Expand?

3 posts, 0 answers
  1. Raymond
    Raymond avatar
    24 posts
    Member since:
    Apr 2009

    Posted 08 Sep 2009 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Sep 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Raymond
    Raymond avatar
    24 posts
    Member since:
    Apr 2009

    Posted 09 Sep 2009 Link to this post

    Works great!

    Thanks Shinu.

    /R
Back to Top