This is a migrated thread and some comments may be shown as answers.

Refresh on second AjaxSetting

4 Answers 95 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 06 Mar 2009, 04:09 AM
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> 
 
 

4 Answers, 1 is accepted

Sort by
0
Stephen
Top achievements
Rank 1
answered on 06 Mar 2009, 09:25 PM
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.
0
Iana Tsolova
Telerik team
answered on 09 Mar 2009, 10:05 AM
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.
0
Stephen
Top achievements
Rank 1
answered on 09 Mar 2009, 05:23 PM
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
0
Stephen
Top achievements
Rank 1
answered on 10 Mar 2009, 01:07 AM
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.
Tags
Ajax
Asked by
Stephen
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or