stop postback on Collapse Client event

3 posts, 0 answers
  1. Francesco
    Francesco avatar
    16 posts
    Member since:
    Mar 2011

    Posted 14 Mar 2011 Link to this post

    Hi, I wolud like to stop postback call on collapse event. How I do?  I have a Panel bar that on click (server) bind a grid inside him and expan panel. This is ok, but them when I click on expand panel the control recall server side, and then, collapse panel. I wolud like to call serve when expand but not then collapse. Can I do?
    thank

    <telerik:RadAjaxPanel ID="RadAjaxPanel1Contratti" runat="server" Height="100%"
                        LoadingPanelID="RadAjaxLoadingPanel1" 
                        ClientEvents-OnResponseEnd="adjustSizeEnd" 
                        ClientEvents-OnRequestStart="adjustSizeStart">             
                        <telerik:RadPanelBar runat="server" ID="RadPanelBarContratti" 
                        AllowCollapseAllItems="True" Width="100%" 
                        CssClass="panelBoxOut"
                        onitemclick="RadPanelBarContratti_ItemClick" 
                        OnClientItemExpand="OnExpand" 
                        OnClientItemCollapse="OnCollapse">
                            <Items>                
                                <telerik:RadPanelItem Text="Contratti" value="pnlDataAnagafica">
                                    <Items>
                                        <telerik:RadPanelItem Value="Grid">
                                            <ItemTemplate>     
                                            <div class="panelBoxIn">                                                                              
                                                <telerik:RadGrid ID="grdContratti" runat="server" DataSourceID="ObjectDataSourceContratti" 
                                                GridLines="None" Visible ="False" AutoGenerateColumns="False">
                                                    <MasterTableView>                                                                                                                  
                                                    </MasterTableView>
                                                </telerik:RadGrid>   
                                            </div>
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>                
                            </Items>
                        </telerik:RadPanelBar>   
                    </telerik:RadAjaxPanel>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Mar 2011 Link to this post

    Hello Francesco,
    You can achieve the same by subscribing to the RadPanelBar client side event OnClientItemClicking and cancel the postback from there. Here is a sample code.
    Javascript:
    function OnClientItemClicking(sender, eventArgs)
      {
           var item = eventArgs.get_item();
           if (item.get_expanded())
           {
               item.collapse();
               eventArgs.set_cancel(true); // Cancel the postback 
           }
      }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Francesco
    Francesco avatar
    16 posts
    Member since:
    Mar 2011

    Posted 15 Mar 2011 Link to this post

    WOW, work great!!!!!  Thank a lots
Back to Top