Refresh on second AjaxSetting

5 posts, 0 answers
  1. Stephen
    Stephen avatar
    70 posts
    Member since:
    Mar 2008

    Posted 05 Mar 2009 Link to this post

    I've setup two panels and two buttons, when the listButton is pressed, it should show listPanel, and hide galleryPanel, when the galleryButton is pressed, it then should show the galleryPanel and hide the listPanel.  
    The first button seems to be doing ajax, but the second causes a page refresh (postback).

    Any help would be appreciated...

            <asp:ScriptManager id="scriptManager" runat="server"></asp:ScriptManager>  
            <telerik:radajaxmanager id="Radajaxmanager" runat="server"
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="listButton"
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="listPanel"></telerik:AjaxUpdatedControl> 
                            <telerik:AjaxUpdatedControl ControlID="galleryPanel"></telerik:AjaxUpdatedControl> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="galleryButton"
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="listPanel"></telerik:AjaxUpdatedControl> 
                            <telerik:AjaxUpdatedControl ControlID="galleryPanel"></telerik:AjaxUpdatedControl> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:radajaxmanager> 
     
            <asp:Button ID="listButton" runat="server" Text="List" onclick="listButton_Click" /> 
            <asp:Button ID="galleryButton" runat="server" Text="Gallery" onclick="galleryButton_Click" /> 
     
            <div> 
                <telerik:RadAjaxPanel id="listPanel" runat="server" style="display: none;"
                    List Panel 
                </telerik:RadAjaxPanel> 
                <telerik:RadAjaxPanel id="galleryPanel" runat="server" style="display: none;"
                    Gallery Panel 
                </telerik:RadAjaxPanel> 
            </div> 
     
     

  2. Stephen
    Stephen avatar
    70 posts
    Member since:
    Mar 2008

    Posted 06 Mar 2009 Link to this post

    Does anyone have any ideas?  The only workaround I could find is wrap it all in an RadAjaxPanel and not use the RadAjaxManager.  This doesn't seem very ideal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 09 Mar 2009 Link to this post

    Hi Stephen,

    Please try modifying your code as below and see if it makes any difference:

        <asp:ScriptManager id="scriptManager" runat="server"></asp:ScriptManager>        
            <telerik:radajaxmanager id="Radajaxmanager" runat="server">       
                <AjaxSettings>       
                    <telerik:AjaxSetting AjaxControlID="listButton">       
                        <UpdatedControls>       
                            <telerik:AjaxUpdatedControl ControlID="Panel1">     
                            </telerik:AjaxUpdatedControl>       
                            <telerik:AjaxUpdatedControl ControlID="Panel2">     
                            </telerik:AjaxUpdatedControl>       
                        </UpdatedControls>       
                    </telerik:AjaxSetting>       
                    <telerik:AjaxSetting AjaxControlID="galleryButton">       
                        <UpdatedControls>       
                            <telerik:AjaxUpdatedControl ControlID="Panel1">     
                            </telerik:AjaxUpdatedControl>       
                            <telerik:AjaxUpdatedControl ControlID="Panel2">     
                            </telerik:AjaxUpdatedControl>       
                        </UpdatedControls>       
                    </telerik:AjaxSetting>   
                    <telerik:AjaxSetting AjaxControlID="Panel1">       
                        <UpdatedControls>       
                            <telerik:AjaxUpdatedControl ControlID="Panel1">     
                            </telerik:AjaxUpdatedControl>     
                        </UpdatedControls>       
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="Panel2">       
                        <UpdatedControls>         
                            <telerik:AjaxUpdatedControl ControlID="Panel2">     
                            </telerik:AjaxUpdatedControl>       
                        </UpdatedControls>       
                    </telerik:AjaxSetting>      
                </AjaxSettings>       
            </telerik:radajaxmanager>       
           
            <asp:Button ID="listButton" runat="server" Text="List" onclick="listButton_Click" />       
            <asp:Button ID="galleryButton" runat="server" Text="Gallery" onclick="galleryButton_Click" />       
           
            <div>       
            <asp:Panel ID="Panel1" runat="server">     
                <asp:Panel id="listPanel" runat="server" style="display: none;">       
                    List Panel       
                </asp:Panel>       
            </asp:Panel>    
            <asp:Panel ID="Panel1" runat="server">     
                <asp:Panel id="galleryPanel" runat="server" style="display: none;">       
                    Gallery Panel       
                </asp:Panel>    
            </asp:Panel>       
            </div>     
     

    Find more information on how to ajaxifying controls wrapped in RadAjaxPanel and added to AJAX Manager settings here.

    Note that it is preferable to add only always visible controls to the RadAjaxManager settings as shown above.

    Kind regards,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Stephen
    Stephen avatar
    70 posts
    Member since:
    Mar 2008

    Posted 09 Mar 2009 Link to this post

    Thanks Iana,

    I'll give this a try and let you know what I find by tomorrow.  I should also mentioned, I wasn't showing and hiding using the Visible property.  I was changing what is displayed by changing the display style.  Is this still not recommended or is this the perferred way to accomplish showing and hiding panels through ajax?


    Thanks again,
    Stephen
  6. Stephen
    Stephen avatar
    70 posts
    Member since:
    Mar 2008

    Posted 09 Mar 2009 Link to this post

    I just had a chance to try the original code snippet I provided earlier and it's working now... I have no idea what causes the page refresh in the first place. Very strange. The only difference I can see is that I restarted vs.net.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017