Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

Selected Item is restored when navigating away and then back

$
0
0

Kostadin,

You are very close.  You have recreated 1 of the 4 steps I suggest in order to show the issue.  You are correct.  It is an Ajax POST, not a postback.  I misspoke when I said that.  However, step 1 was never the actual issue.  You have to follow all 4 steps.  Here they are again:

1. Select Test2. This does a post (correct, a "post", not a "postback"). So, a "POST" request should be stored in your history.
2. Click on the "Navigate Away" link.
3. Click the browsers back button. Notice how Test1 is selected (because it is forced on WebUserControl1::Page_PreRender). Notice how a "GET" request was issued (something to do with the TreeList1 ajax setting in WebForm1 RadAjaxManager).
4. Click the "Postback" button. Notice how now Test2 is selected. What we would expect is that the "Test1" row would remain selected and it would not change.

 

Notice how in step 4 I tell you exactly what the issue is.  I also mentioned the actual issue throughout our posts here.  The issue is that the control is loading the row selection (Test2).  I never said the issue was about a "postback" in step 1.

To reproduce this, you will need the navigation link, and the button.  The code is simple.  Here is a page similar to your Default.aspx with the added elements:

<%@ Page Language="C#"
    AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Backlog_11412_Skeleton.WebForm1" %>
<%@ Register TagName="DocumentFormNavigator" TagPrefix="sem" Src="~/WebUserControl1.ascx" %>
 
<headrunat="server">
    <title></title>
</head>
<body>
    <formid="form1"runat="server">
    <div>
        <h2>1. Select Test2.  This does a post.  So, a "POST" request should be stored in your history.<br/>2. Click on the "Navigate Away" link.<br/>3. Click the browsers back button.  Notice how Test1 is selected (because it is forced on WebUserControl1::Page_PreRender).  Notice how a "GET" request was issued (something to do with the TreeList1 ajax setting in WebForm1 RadAjaxManager).<br/>4. Click the "Postback" button.  Notice how now Test2 is selected.  What we would expect is that the "Test1" row would remain selected and it would not change.</h2>
        <br/>
        <br/>
        <ahref="SomeOtherPage.aspx">Navigate Away</a>
        <br/>
        <br/>
    </div>
 
        <telerik:RadScriptManagerID="RadScriptManager1"runat="server">
            <Scripts>
                <asp:ScriptReferenceAssembly="Telerik.Web.UI"Name="Telerik.Web.UI.Common.Core.js"/>
                <asp:ScriptReferenceAssembly="Telerik.Web.UI"Name="Telerik.Web.UI.Common.jQuery.js"/>
                <asp:ScriptReferenceAssembly="Telerik.Web.UI"Name="Telerik.Web.UI.Common.jQueryInclude.js"/>
            </Scripts>
        </telerik:RadScriptManager>
         <telerik:RadAjaxManagerrunat="server"ID="amMain"EnableHistory="False"EnablePageHeadUpdate="False"
            UpdatePanelsRenderMode="Block"EnableAJAX="true">
            <AjaxSettings>
                <telerik:AjaxSettingAjaxControlID="mpMain">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControlControlID="mpMain"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadMultiPageID="mpMain"runat="server"CssClass="pageView"SelectedIndex="0">
            <telerik:RadPageViewID="pvForms"CssClass="pvForms"runat="server"Selected="True">
                <sem:documentformnavigatorid="dfnMain"runat="server"visible="true"
                    ajaxmanager="amMain"/>
            </telerik:RadPageView>
            <telerik:RadPageViewID="pvLocked"runat="server">
            </telerik:RadPageView>
            <telerik:RadPageViewID="pvDrafts"runat="server">
            </telerik:RadPageView>
        </telerik:RadMultiPage>
 
        <asp:ButtonID="cmdSave"runat="server"Text="Postback"/>
    </form>
</body>
</html>

 

Here is a video following the four steps and demonstrating the issue I have been talking about: Video

 


Viewing all articles
Browse latest Browse all 78072

Trending Articles