Unable to ajaxify the Panel

2 posts, 0 answers
  1. sathies
    sathies avatar
    37 posts
    Member since:
    Oct 2008

    Posted 17 Jan 2009 Link to this post

    Hi,

         In the following code  I set the ajax for the panel and RadPanelBar but it's not working. But it cause  postback on RadPanelBar click.

    what wrong in this code.


    Default.aspx:

     <div> 
              
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            </asp:ScriptManager> 
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="MenuRadPanelBar">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="MenuRadPanelBar" /> 
                            <telerik:AjaxUpdatedControl ControlID="panel1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
             
            </telerik:RadAjaxManager> 
            <telerik:RadSplitter ID="RadSplitter1" BorderColor="White"  Height="100%" Width="100%" runat="server" Orientation="Vertical">  
                <telerik:RadPane runat="server" Width="210px"  ID="TopPane">  
                   <telerik:RadSplitter ID="RadSplitter4" BorderColor="White"   runat="server" Orientation="Horizontal">  
                    <telerik:RadPane ID="RadPane1" Height="100px"  runat="server">  
                        <asp:Button ID="Button1" runat="server"   Text="Button" onclick="Button1_Click" /> 
                    </telerik:RadPane> 
                    <telerik:RadSplitBar ID="RadSplitBar2" BorderColor="White"  Visible="false"  runat="server" /> 
                    <telerik:RadPane ID="RadPane2" runat="server" > 
                       <telerik:RadPanelBar  Height="600px" Width="190px" ID="MenuRadPanelBar" runat="server" 
                                            Skin="Outlook" ExpandMode="FullExpandedItem"   
                            BackColor="#e8e8e8" onitemclick="MenuRadPanelBar_ItemClick">  
                                            
                                            <Items> 
                                                <telerik:RadPanelItem runat="server" Text="Manage" > 
                                                      
                                                </telerik:RadPanelItem> 
                                                  
                                            </Items> 
                                            <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
                                        </telerik:RadPanelBar>    
                    </telerik:RadPane> 
                      </telerik:RadSplitter> 
                </telerik:RadPane> 
                <telerik:RadSplitBar runat="server" ID="RadSplitBar1" BorderColor="White"  Visible="false" /> 
                <telerik:RadPane runat="server" ID="MiddlePane">  
                    <telerik:RadSplitter ID="RadSplitter2"  BorderColor="White"   runat="server" Orientation="Horizontal">  
                    <telerik:RadPane ID="MiddleLeft" Height="100px"  runat="server">  
                      
                    </telerik:RadPane> 
                    <telerik:RadSplitBar ID="RadSplitter3" BorderColor="White"   Visible="false"  runat="server" /> 
                    <telerik:RadPane ID="MiddleRight" runat="server" > 
                        <asp:Panel ID="Panel1" runat="server">  
                          
                       <iframe id="load" runat="server"  ></iframe>   
                       </asp:Panel> 
                    </telerik:RadPane> 
                    </telerik:RadSplitter> 
                 
                </telerik:RadPane> 
            </telerik:RadSplitter>    </div> 

    Default.aspx.cs:
      protected void MenuRadPanelBar_ItemClick(object sender, Telerik.Web.UI.RadPanelBarEventArgs e)  
        {  
            HtmlControl frame1 = (HtmlControl)this.FindControl("load");  
            frame1.Attributes["src"] = "Default2.aspx";  
     
             
     
        } 
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 19 Jan 2009 Link to this post

    Hi sathies,
    I suppose you think that you are performing a postback, and not a callback in this case, because you can see the progress bar of the browser indicating some progress. This actually is caused by the fact that you load another page in the IFRAME and is browser behavior rather than something caused by any of our controls. You can test this with a page, as simple as the one below:
    <body> 
        <form id="form1" runat="server"
            <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
             
            <asp:UpdatePanel ID="UpdatePanel1" runat="server"
                <ContentTemplate> 
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" /> 
                     
                    <iframe id="load" runat="server"  ></iframe>    
                </ContentTemplate> 
            </asp:UpdatePanel> 
        </form>     
    </body> 

    protected void Button1_Click(object sender, EventArgs e) 
        HtmlControl frame1 = (HtmlControl)this.FindControl("load"); 
        frame1.Attributes["src"] = "Default2.aspx";   

    Please note that even though you see the progress bar, indicating  progress, you are actually performing a callback, not a postback. In case you try to update a control, which is not in the UpdatePanel, you will see that the control will not be updated. For example:
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"
        <ContentTemplate> 
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" /> 
             
            <iframe id="load" runat="server"  ></iframe>    
        </ContentTemplate> 
    </asp:UpdatePanel> 
    <asp:Label ID="Label1" runat="server"></asp:Label> 

    protected void Button1_Click(object sender, EventArgs e) 
        HtmlControl frame1 = (HtmlControl)this.FindControl("load"); 
        frame1.Attributes["src"] = "Default2.aspx"
     
        Label1.Text = "Postback"

    In case you execute that code, you will notice that the Label will not be updated. The progress bar in this case only shows that another page is being loaded.

    Regards,
    Tsvetie
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top