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

Losing scroll position

3 Answers 108 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 03 Dec 2013, 09:18 PM
I have a page with multiple buttons in an ajaxpanel and when I click any buttons after the first button, the page scrolls back to the top. if I click the very first button (updateFormButton) it keeps the scroll position. Any ideas why? Here's my code

<%@ Page Title="" Language="VB" MaintainScrollPositionOnPostback="true" MasterPageFile="~/Main.master" AutoEventWireup="false" CodeFile="EditSafetyForm.aspx.vb" Inherits="admin_EditSafetyForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
 
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContentPlaceHolder" Runat="Server">
     
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="success">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="formTypeDrop">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="defaultTextInput">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="updateContentButton">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="questionInput">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="updateQuestion">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="deleteQuestionButton">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="answerTypeDrop">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="addQuestionButton">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="answerItemsPanel">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="questionsGrid">
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <telerik:RadAjaxPanel ID="RadAjaxPanel3" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" HorizontalAlign="NotSet">
    <telerik:RadToolTip runat="server" ID="success" Height="60px" Width="250px" Position="Center"
        RelativeTo="BrowserWindow" AutoCloseDelay="6000">
    </telerik:RadToolTip>
    <h2><asp:Label ID="nameOutput" runat="server"></asp:Label></h2>
    <h3>Form Type</h3>
    <telerik:RadComboBox ID="formTypeDrop" runat="server" AutoPostBack="true">
            <Items>
                <telerik:RadComboBoxItem Value="1" Text="OSHA" />
                <telerik:RadComboBoxItem Value="2" Text="Personal" />
            </Items>
            <CollapseAnimation Duration="1000" Type="InBack" />
        </telerik:RadComboBox>
    <h3>Description</h3>
    <div class="safeItem">
    <telerik:RadEditor ID="defaultTextInput" runat="server" Width="800" Height="500px">
    </telerik:RadEditor><br />
    <asp:Button ID="updateContentButton" runat="server" Text="Update Form" /> <br /><br />
        <div style="clear: both;"></div>
        </div>
    <div style="clear: both;"></div>
    <br />
    <h3>Add Questions</h3>
    <div class="safeLabel">Question Text:</div>
    <div class="safeItem"><asp:TextBox ID="questionInput" runat="server" Width="450"></asp:TextBox>
           <asp:Button ID="updateQuestion" runat="server" Text="Update Question" />   
        <asp:Button ID="deleteQuestionButton" runat="server" Text="Delete" />
    </div>
    <div class="safeLabel">Answer Type:</div>
    <div class="safeItem">
        <telerik:RadComboBox ID="answerTypeDrop" runat="server" AutoPostBack="true">
            <Items>
                <telerik:RadComboBoxItem Value="Text" Text="Text" />
                <telerik:RadComboBoxItem Value="Drop" Text="Dropdown" />
                <telerik:RadComboBoxItem Value="List" Text="List" />
            </Items>
            <CollapseAnimation Duration="1000" Type="InBack" />
        </telerik:RadComboBox>
            
        <asp:Button ID="addQuestionButton" runat="server" Text="Add New Question" />
    </div>
    <asp:Panel ID="answerItemsPanel" runat="server" Visible="false">
        <div class="safeLabel">Available Items:</div>
        <div class="safeItem">
            <asp:TextBox ID="answerItemInput" runat="server" Width="450"></asp:TextBox>   
            <asp:Button ID="addAnswerButton" runat="server" Text="Add" />
        </div>
         
        <div class="safeLabel"><br /><br /><b>Existing Answers:</b></div>
        <div class="safeItem">
            <telerik:RadGrid ID="answersGrid" runat="server" GridLines="None" AllowPaging="True"
            AllowSorting="True" AutoGenerateColumns="false" PageSize="50" Width="800" AutoGenerateDeleteColumn="true">
                <MasterTableView DataKeyNames="SafetyFormQuestionAnswersId" AutoGenerateColumns="false">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="SafetyFormQuestionAnswersId" HeaderText="SafetyFormQuestionAnswersId" SortExpression="SafetyFormQuestionAnswersId"
                            UniqueName="SafetyFormQuestionAnswersId" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="AnswerText" HeaderStyle-Width="400" HeaderText="Text" SortExpression="AnswerText"
                            UniqueName="AnswerText">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </asp:Panel>
    <br />
    <h3 style="clear: both;"><br />Edit Existing Questions</h3>
    <div class="safeLabel"> </div>
    <div class="safeItem">
        <telerik:RadGrid ID="questionsGrid" runat="server" GridLines="None" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="false" PageSize="50" AllowFilteringByColumn="true" Width="800" AutoGenerateDeleteColumn="true">
            <MasterTableView DataKeyNames="SafetyFormQuestionsId" AutoGenerateColumns="false">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn EditText="Edit" HeaderStyle-Width="50"></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="SafetyFormQuestionsId" HeaderText="SafetyFormQuestionsId" SortExpression="SafetyFormQuestionsId"
                        UniqueName="SafetyFormQuestionsId" Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="QuestionText" HeaderText="Question" HeaderStyle-Width="250" SortExpression="QuestionText"
                        UniqueName="QuestionText">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="QuestionType" AllowFiltering="false" HeaderText="Answer Type" HeaderStyle-Width="95" SortExpression="QuestionType"
                        UniqueName="QuestionType">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="AnsList" AllowFiltering="false" HeaderText="Possible Answers" HeaderStyle-Width="250" SortExpression="AnsList"
                        UniqueName="AnsList">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <br /><br />
    </div>
        </telerik:RadAjaxPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" SkinID="Hay"
            Height="25px" Transparency="1" BackgroundPosition="Center" >
            <img alt="Loading..." src="../login.gif" height="200" width="200" style="border: 0px;" />
        </telerik:RadAjaxLoadingPanel>
     
</asp:Content>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 06 Dec 2013, 08:09 AM
Hello,

Please note that using RadAjaxPanel simultaneously with RadAjaxManager or UpdatePanel ( or implementing multiple wrapped RadAjaxPanels ) is not a supported scenario and we highly recommend to avoid such implementation. Please either use just the manager to update your controls replacing the UpdatePanel / RadAjaxPanel with a regular asp:Panel, or use the UpdatePanel / RadAjaxPanel alone to wrap your page:
http://www.telerik.com/help/aspnet-ajax/ajax-controls-in-ajaxpanel-and-ajaxsettings.html

Hope this helps. Please make the suggested modification and let us know about the result.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 06 Dec 2013, 02:23 PM
I actually added the ajax manager becase I had a tool tip I show on postback. When I don't have the ajax manager, the tool tip doesn't show when you update a button. So, which should I use, ajax manager or ajax panel?

updating my aspx to
    <telerik:RadAjaxPanel ID="RadAjaxPanel3" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" HorizontalAlign="NotSet">
    <telerik:RadToolTip runat="server" ID="success" Height="60px" Width="250px" Position="Center"
        RelativeTo="BrowserWindow" AutoCloseDelay="6000">
    </telerik:RadToolTip>
    <h2><asp:Label ID="nameOutput" runat="server"></asp:Label></h2>
    <h3>Form Type</h3>
    <telerik:RadComboBox ID="formTypeDrop" runat="server" AutoPostBack="true">
            <Items>
                <telerik:RadComboBoxItem Value="1" Text="OSHA" />
                <telerik:RadComboBoxItem Value="2" Text="Personal" />
            </Items>
            <CollapseAnimation Duration="1000" Type="InBack" />
        </telerik:RadComboBox>
    <h3>Description</h3>
    <div class="safeItem">
    <telerik:RadEditor ID="defaultTextInput" runat="server" Width="800" Height="500px">
    </telerik:RadEditor><br />
    <asp:Button ID="updateContentButton" runat="server" Text="Update Form" /> <br /><br />
        <div style="clear: both;"></div>
        </div>
    <div style="clear: both;"></div>
    <br />
    <h3>Add Questions</h3>
    <div class="safeLabel">Question Text:</div>
    <div class="safeItem"><asp:TextBox ID="questionInput" runat="server" Width="450"></asp:TextBox>
           <asp:Button ID="updateQuestion" runat="server" Text="Update Question" />   
        <asp:Button ID="deleteQuestionButton" runat="server" Text="Delete" />
    </div>
    <div class="safeLabel">Answer Type:</div>
    <div class="safeItem">
        <telerik:RadComboBox ID="answerTypeDrop" runat="server" AutoPostBack="true">
            <Items>
                <telerik:RadComboBoxItem Value="Text" Text="Text" />
                <telerik:RadComboBoxItem Value="Drop" Text="Dropdown" />
                <telerik:RadComboBoxItem Value="List" Text="List" />
            </Items>
            <CollapseAnimation Duration="1000" Type="InBack" />
        </telerik:RadComboBox>
            
        <asp:Button ID="addQuestionButton" runat="server" Text="Add New Question" />
    </div>
    <asp:Panel ID="answerItemsPanel" runat="server" Visible="false">
        <div class="safeLabel">Available Items:</div>
        <div class="safeItem">
            <asp:TextBox ID="answerItemInput" runat="server" Width="450"></asp:TextBox>   
            <asp:Button ID="addAnswerButton" runat="server" Text="Add" />
        </div>
         
        <div class="safeLabel"><br /><br /><b>Existing Answers:</b></div>
        <div class="safeItem">
            <telerik:RadGrid ID="answersGrid" runat="server" GridLines="None" AllowPaging="True"
            AllowSorting="True" AutoGenerateColumns="false" PageSize="50" Width="800" AutoGenerateDeleteColumn="true">
                <MasterTableView DataKeyNames="SafetyFormQuestionAnswersId" AutoGenerateColumns="false">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="SafetyFormQuestionAnswersId" HeaderText="SafetyFormQuestionAnswersId" SortExpression="SafetyFormQuestionAnswersId"
                            UniqueName="SafetyFormQuestionAnswersId" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="AnswerText" HeaderStyle-Width="400" HeaderText="Text" SortExpression="AnswerText"
                            UniqueName="AnswerText">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </asp:Panel>
    <br />
    <h3 style="clear: both;"><br />Edit Existing Questions</h3>
    <div class="safeLabel"> </div>
    <div class="safeItem">
        <telerik:RadGrid ID="questionsGrid" runat="server" GridLines="None" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="false" PageSize="50" AllowFilteringByColumn="true" Width="800" AutoGenerateDeleteColumn="true">
            <MasterTableView DataKeyNames="SafetyFormQuestionsId" AutoGenerateColumns="false">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn EditText="Edit" HeaderStyle-Width="50"></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="SafetyFormQuestionsId" HeaderText="SafetyFormQuestionsId" SortExpression="SafetyFormQuestionsId"
                        UniqueName="SafetyFormQuestionsId" Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="QuestionText" HeaderText="Question" HeaderStyle-Width="250" SortExpression="QuestionText"
                        UniqueName="QuestionText">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="QuestionType" AllowFiltering="false" HeaderText="Answer Type" HeaderStyle-Width="95" SortExpression="QuestionType"
                        UniqueName="QuestionType">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="AnsList" AllowFiltering="false" HeaderText="Possible Answers" HeaderStyle-Width="250" SortExpression="AnsList"
                        UniqueName="AnsList">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <br /><br />
    </div>
        </telerik:RadAjaxPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" SkinID="Hay"
            Height="25px" Transparency="1" BackgroundPosition="Center" >
            <img alt="Loading..." src="../login.gif" height="200" width="200" style="border: 0px;" />
        </telerik:RadAjaxLoadingPanel>
     
</asp:Content>


Then, when you click the first button, the tool tip shows, but it doesn't show for any of the other button clicks. Also, removing the ajax manager still does not fix my first issue of it not keeping it's spot in the page.

0
Eyup
Telerik team
answered on 11 Dec 2013, 10:13 AM
Hi,

I have created a sample RadGrid web site using the provided snippets to test the described behavior. Both the ToolTip and Buttons loading work as expected on my side. Can you please run the attached web site and instruct me the exact steps to reproduce the problem?

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
Web Services
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Web Services
Top achievements
Rank 2
Share this question
or