PanelBar update from other control

6 posts, 0 answers
  1. Gary
    Gary avatar
    7 posts
    Member since:
    Sep 2008

    Posted 22 Sep 2008 Link to this post

    I have a layout with two seperate sections (based on a master page) and in one section (Left) I have a PanelBar insde of an AjaxPanel and in the other (Right) I have an another AjaxPanel with user controls.  When the user makes a particular change in the AjaxPanel on the right I want to update the PanelBar (via the AjaxPanel) on the left.

    Using normal ASP Update Panels I would just to a LeftPanel.Update();.  How can I accomplish this?

    In particular, I don't need the entire left panel to update, just the PanelBar. 
  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 24 Sep 2008 Link to this post

    Hello Gary,

    Generally, the AJAX Panel is designed to update its content only, but you can still achieve interactions between the AJAX Panels as explained in documentation here.

    Greetings,
    Konstantin Petkov
    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
  4. Gary
    Gary avatar
    7 posts
    Member since:
    Sep 2008

    Posted 28 Sep 2008 Link to this post

    Konstantin,

    I believe I understand what you are saying.  I'm tried a couple scenarios but I still can't get updates cross panels to work.

    Here is the bigger scenario.  We have a master page that has two content panes on there.  We derive the two panes on the web page.  Pane1 is the left hand navigation (radtree) and Pane2 is the content area.

    I have put the RadScriptManager onto the master page as per the FAQ.  I then created a proxy control in Pane1 and another in Pane2.  The proxy control on pane 1 is triggered by the radtree and updates Pane1PanelNav and Pane2PaneContent (as the controls have been named).    On the Pane2PaneContent controls, I set the proxy for that to update Pane1PanelNav and Pane2PanelContent.  This logically should update both panels when either side is updated.

    But when I do this, only the triggered side is update.
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 29 Sep 2008 Link to this post

    Hi Gary,

    Will it be convenient for you to send us sample runnable project which shows your scenario and replicates the described behaviour? Also the exact steps for replicating the problem will be helpful for easily isolate the source of the issue. As soon as we have runnable application we will do our best to provide accurate solution as soon as possible.

    All the best,
    Maria Ilieva
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Dave Miller
    Dave Miller avatar
    64 posts
    Member since:
    Oct 2004

    Posted 29 Sep 2008 Link to this post

    Gary,

    I use this for similar scenarios

    On the masterpage function to update controls
            protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)  
            {  
     
                //   RadAjaxManager1.Alert("AjaxRequest raised from the " + e.Argument);        
                if (e.Argument == "RebindProdGrid")  
                {  
     
                    UserControl customControl = (UserControl)Page.FindControl("customCntl");  
                    RadGrid radGrid = (RadGrid)customControl.FindControl("RadGrid1");  
                    radGrid.Rebind();  
     
                }  
            }  
     
     Javascript on masterpage to call function

    function RefreshProdGrid()  
                    {  
                        var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>");  
                        ajaxManager.ajaxRequest("RebindProdGrid");  
                    } 

    On usercontrols

    <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 

    "RadAjaxManager1" is on master page. Simple call the javascript function "RefreshProductGrid" from another control in an update function using something like this to update the control in the other usercontrol.

    ScriptManager.RegisterClientScriptBlock(  
                   this.Page,  
                   this.GetType(),  
                   "WebUserControlSript",  
                   "RefreshProdGrid()",  
                   true); 


    Hope this helps

    Regards,
    Dave
  7. Gary
    Gary avatar
    7 posts
    Member since:
    Sep 2008

    Posted 29 Sep 2008 Link to this post

    Okay, I started over.  Instead of trying to bring an existing project up to speed I create a new master page and new client page to validate.  I managed to get it to work at first but ran into some problems with controls on two seperate content panes.

    But I did find a solution.  Since some of my test controls were dynamically generated I had a problem with the Ajax manager.  So I added the controls dynamically and then added the action to the ajax manager dynamically (right after loading the controls) and everything is working as expected on the test form.


    public partial class GaryPage : System.Web.UI.Page  
        {  
            protected void Page_Load(object sender, EventArgs e)  
            {  
                if (!IsPostBack)  
                {  
                    RadTreeView1.LoadContentFile("~/MenuData/Menu1.xml");  
                }  
     
                AjaxSetting ajax;  
     
                RadAjaxManagerProxy1.AjaxSettings.Clear();  
     
                ajax = new AjaxSetting();  
                ajax.AjaxControlID = "RadTreeView1";  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("Label1", ""));  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("Button1", ""));  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("panelBob", ""));  
                RadAjaxManagerProxy1.AjaxSettings.Add(ajax);  
     
     
                ajax = new AjaxSetting();  
                ajax.AjaxControlID = "Button1";  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("Label1", ""));  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("RadTreeView1", ""));  
                ajax.UpdatedControls.Add(new AjaxUpdatedControl("panelBob", ""));  
                RadAjaxManagerProxy1.AjaxSettings.Add(ajax);  
            }  
     
            protected void Button1_Click(object sender, EventArgs e)  
            {  
                RadTreeView1.LoadContentFile("~/MenuData/Menu2.xml");  
     
            }  
     
            protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)  
            {  
                Label1.Text = e.Node.Text;  
                panelBob.Controls.Clear();  
                Label l = new Label();  
                l.Text = DateTime.Now.Ticks.ToString();  
                panelBob.Controls.Add(l);  
            }  
        } 

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
    </asp:Content> 
    <%--<AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadTreeView1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> 
                        <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                        <telerik:AjaxUpdatedControl ControlID="panelBob" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="Button1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> 
                        <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                        <telerik:AjaxUpdatedControl ControlID="panelBob" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings>--%> 
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
              
        </telerik:RadAjaxManagerProxy> 
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" HorizontalAlign="NotSet" 
            LoadingPanelID="RadAjaxLoadingPanel1" Width="300px">  
            <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">  
            </telerik:RadTreeView> 
        </telerik:RadAjaxPanel> 
    </asp:Content> 
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">  
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
            Width="75px">  
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
                style="border: 0px;" /> 
        </telerik:RadAjaxLoadingPanel> 
        <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Height="200px" HorizontalAlign="NotSet" 
            LoadingPanelID="RadAjaxLoadingPanel1" Width="300px">  
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
            <br /> 
            <asp:Panel ID="panelBob" runat="server" /> 
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> 
        </telerik:RadAjaxPanel> 
    </asp:Content> 
     

    Master page:

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server">  
        <title>Untitled Page</title> 
        <asp:ContentPlaceHolder ID="head" runat="server">  
        </asp:ContentPlaceHolder> 
    </head> 
    <body> 
        <form id="form1" runat="server">  
        <asp:ScriptManager ID="scriptmanagerGlobal" runat="server">  
        </asp:ScriptManager> 
        <telerik:RadAjaxManager ID="radajaxmanagerGlobal" runat="server">  
        </telerik:RadAjaxManager> 
        <div> 
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">  
              
            </asp:ContentPlaceHolder> 
            <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">  
              
            </asp:ContentPlaceHolder> 
        </div> 
        </form> 
    </body> 
    </html> 
     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017