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

Selected Item is restored when navigating away and then back

19 Answers 86 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 08 Jul 2016, 11:37 PM

We have a RadTreeList that is inside an ASP.NET control.  On the Page_PreRender of the control we are resetting the selected item (TreeListName.Items[0].Selected = true). 

However, when we select something, navigate away from the page, and then back to the page the selected item is getting reset at some point to the selection that it was prior to navigating away.  This occurs despite the fact the the selection is getting forced in the PreRender event.

I believe this has something to do with Ajax and/or ViewState.  I tried turning off ViewState for the control using EnableViewState = false but the control did not render even though we are using the NeedDataSource event and there was a collection assigned to the DataSource within that event.  We have always used NeedDataSource so we know that it works when ViewState is enabled.

Do you have any suggestions or advice?

 

Thank you.

19 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 14 Jul 2016, 07:18 AM
Hi,

Can you please try to disable the Ajax on the page and see of this makes any difference? Also please elaborate on how exactly you navigate out of the page so that we can try to replicate the issue locally and advise you further.

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 05 Aug 2016, 04:26 PM

Thank you.  We just press the back button to go back.  We cannot disable Ajax since we rely on it for the application.  I have included a skeleton project.  Follow the instructions on the main screen.  What we would expect is that either the selection is re-posted in a postback request (instead of a "GET" request) when you go back in the browser, or the selection does not change.  Either one would keep us from having issues.  

For the attached file, rename .png to .zip.

Thank you for your help.

0
Tim
Top achievements
Rank 1
answered on 05 Aug 2016, 04:30 PM
We are using Telerik Web UI version 2015.1.401.40.  We are not able to upgrade at this time.
0
Maria Ilieva
Telerik team
answered on 10 Aug 2016, 11:53 AM
Hi,

I would suggests you to review the help topic below that explains how to keep the browser's history when browser's back and forward buttons are used with Ajax:
http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/troubleshooting/back-and-forward-browser-buttons

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 10 Aug 2016, 04:20 PM

We are not trying to enable browser history.  We are trying to keep the functionality of your controls stable when someone uses the browser back button.  Your controls are not stable in this case.

The statement from your link of ""that is the reason for them not to remember the last page state after ajax request." does not apply to us.  Your control is trying to remember the last page state and is trying to set itself.

We would be fine if the control did not try to set itself at all.  Therefore, we do not need to research how to enable functionality that we don't want.

Please run and observe the skeleton project that I have attached.  Based on your response, it seems as though you have not done that.

 

Thanks,

Tim

0
Tim
Top achievements
Rank 1
answered on 10 Aug 2016, 05:37 PM
Please note that the browser we used to replicate the issue was Chrome 52.0.2743.116, and earlier versions of Chrome.
0
Tim
Top achievements
Rank 1
answered on 10 Aug 2016, 05:41 PM
I also just tried Firefox 48.0 and was able to replicate the issue.
0
Maria Ilieva
Telerik team
answered on 15 Aug 2016, 02:49 PM
Hello Tim,

Note that the png skeleton that you have sent can not be downloaded and renamed to zip as this is not allowed from our system in forum posts. Please open a separate official support ticket and send us your project as zip archive so that we can revise it locally and advise you further.

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 15 Aug 2016, 08:24 PM

Currently, I am not able to open a support ticket.  If you are unable to log into this forum through another public login (like I am doing and most likely everyone else can do) and download the file (like most everyone can that creates any account tied to an email) then I guess I will have to drop it.

My hope is however that you just create some sort of account (tied to a gmail email or anything really) and access it outside of your system to get to the file.

 

Thanks.

0
Maria Ilieva
Telerik team
answered on 18 Aug 2016, 01:22 PM
Hi,

Note that the forum threads does not allow attaching projects and this is company policy. I would suggest you to share your code using the code block formatting so that we can revise your code and advise you further.

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 18 Aug 2016, 05:44 PM

WebForm1.aspx:

<%@ Page Language="C#" MasterPageFile="Site1.Master"
    AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Backlog_11412_Skeleton.WebForm1"
    ValidateRequest="false" EnableEventValidation="false" %>
<%@ Register TagName="DocumentFormNavigator" TagPrefix="sem" Src="~/WebUserControl1.ascx" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
</asp:Content>
 
<asp:Content ID="SheetContent" ContentPlaceHolderID="SheetContentPlaceHolder" runat="Server">
    <telerik:RadMultiPage ID="mpMain" runat="server" CssClass="pageView" SelectedIndex="0">
        <telerik:RadPageView ID="pvForms" CssClass="pvForms" runat="server" Selected="True">
            <sem:DocumentFormNavigator ID="dfnMain" runat="server" Visible="true"
                AjaxManager="amMain" />
        </telerik:RadPageView>
        <telerik:RadPageView ID="pvLocked" runat="server">
        </telerik:RadPageView>
        <telerik:RadPageView ID="pvDrafts" runat="server">
        </telerik:RadPageView>
    </telerik:RadMultiPage>
 
    <asp:Button ID="cmdSave" runat="server" Text="Postback" />
 
    <telerik:RadAjaxManager runat="server" ID="amMain" EnableHistory="False" EnablePageHeadUpdate="False"
        UpdatePanelsRenderMode="Block" EnableAJAX="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="TreeList1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="TreeList1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
</asp:Content>

WebForm1.aspx.designer.cs:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace Backlog_11412_Skeleton {
     
     
    public partial class WebForm1 {
         
        /// <summary>
        /// ScriptManagerProxy1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.ScriptManagerProxy ScriptManagerProxy1;
         
        /// <summary>
        /// mpMain control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadMultiPage mpMain;
         
        /// <summary>
        /// pvForms control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadPageView pvForms;
         
        /// <summary>
        /// dfnMain control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Backlog_11412_Skeleton.WebUserControl1 dfnMain;
         
        /// <summary>
        /// pvLocked control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadPageView pvLocked;
         
        /// <summary>
        /// pvDrafts control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadPageView pvDrafts;
         
        /// <summary>
        /// cmdSave control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button cmdSave;
         
        /// <summary>
        /// amMain control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadAjaxManager amMain;
    }
}

WebForm1.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Backlog_11412_Skeleton
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
    }
}

WebUserControl1.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="Backlog_11412_Skeleton.WebUserControl1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadScriptBlock ID="rcbGrid" runat="server">
    <script type="text/javascript">
        var _treeList = null;
 
        function OnSectionItemClick(sender, eventArgs) {
            var treelist = $find('<%=TreeList1.ClientID %>');
 
            treelist.selectItem(eventArgs.get_item());
            sender.fireCommand("ItemClick", eventArgs.get_item().get_displayIndex());
        }
    </script>
</telerik:RadScriptBlock>
 
<telerik:RadTreeList runat="server" ID="TreeList1" DataKeyNames="FormId" ClientDataKeyNames="FormId, instanceId"
    OnNeedDataSource="TreeList1_NeedDataSource" ParentDataKeyNames="ParentId"
    AutoGenerateColumns="false"
    EnableViewState="true">
    <Columns>
        <telerik:TreeListTemplateColumn HeaderStyle-Width="60%" UniqueName="SectionName"
            HeaderText="Section Name" ItemStyle-CssClass="link">
            <ItemTemplate>
                <span runat="server" class="rbAdd16 rbPredefined16" id="addIcon"></span>
                <%# Eval("Name") %><%# Eval("Key") %>
                <span runat="server" style="color: Red;" visible="false" id="spnRequired">*</span>
            </ItemTemplate>
        </telerik:TreeListTemplateColumn>
        <telerik:TreeListTemplateColumn Display="false" UniqueName="InstanceId">
            <ItemTemplate>
                <asp:Label ID="spnInstanceId" Text='<%# Eval("instanceId") %>' runat="server">
                </asp:Label>
            </ItemTemplate>
        </telerik:TreeListTemplateColumn>
    </Columns>
    <ClientSettings AllowPostBackOnItemClick="false">
        <Selecting AllowItemSelection="true" />
        <ClientEvents OnItemClick="OnSectionItemClick" />
    </ClientSettings>
</telerik:RadTreeList>

WebUserControl1.ascx.designer.cs:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace Backlog_11412_Skeleton {
     
     
    public partial class WebUserControl1 {
         
        /// <summary>
        /// rcbGrid control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadScriptBlock rcbGrid;
         
        /// <summary>
        /// TreeList1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadTreeList TreeList1;
    }
}

WebUserControl1.ascx.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace Backlog_11412_Skeleton
{
    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        public class FormSectionInstance
        {
            public int FormId { get; set; }
            public int? ParentId { get; set; }
            public int? instanceid { get; set; }
            public string Name { get; set; }
            public string Key { get; set; }
        }
 
        protected void TreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
        {
            List<FormSectionInstance> sectionInstances = new List<FormSectionInstance>();
 
            sectionInstances.Add(new FormSectionInstance
            {
                FormId = 1,
                Name = "Test1",
                Key = string.Empty,
                ParentId = null,
                instanceid = 1
            });
 
            sectionInstances.Add(new FormSectionInstance
            {
                FormId = 2,
                Name = "Test2",
                Key = string.Empty,
                ParentId = null,
                instanceid = 2
            });
 
            sectionInstances.Add(new FormSectionInstance
            {
                FormId = 3,
                Name = "Test3",
                Key = string.Empty,
                ParentId = null,
                instanceid = 3
            });
 
            TreeList1.DataSource = sectionInstances;
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TreeList1.Items[0].Selected = true;
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
        }
 
    }
}

Site1.Master.designer.cs:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace Backlog_11412_Skeleton {
     
     
    public partial class Site1 {
         
        /// <summary>
        /// form1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlForm form1;
         
        /// <summary>
        /// masterScriptManager control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Telerik.Web.UI.RadScriptManager masterScriptManager;
         
        /// <summary>
        /// HeaderContentPlaceHolder control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.ContentPlaceHolder HeaderContentPlaceHolder;
         
        /// <summary>
        /// SheetContentPlaceHolder control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.ContentPlaceHolder SheetContentPlaceHolder;
    }
}

Site1.Master.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Backlog_11412_Skeleton
{
    public partial class Site1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
    }
}

Site1.Master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Backlog_11412_Skeleton.Site1" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="masterScriptManager" runat="server" EnableHistory="false" >
        </telerik:RadScriptManager>
 
    <div>
            <asp:ContentPlaceHolder ID="HeaderContentPlaceHolder" runat="server">
            </asp:ContentPlaceHolder>
    </div>
 
    <div>
        <h2>1. Select Test2.  This does a postback.  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 />
        <a href="SomeOtherPage.aspx">Navigate Away</a>
        <br />
        <br />
    </div>
 
    <div>
        <asp:ContentPlaceHolder ID="SheetContentPlaceHolder" runat="server">
         
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

SomeOtherPage.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SomeOtherPage.aspx.cs" Inherits="Backlog_11412_Skeleton.SomeOtherPage" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <h1>Some Other Page</h1>
    <br />
    <h2>Click the browser's back button.</h2>
</body>
</html>

SomeOtherPage.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Backlog_11412_Skeleton
{
    public partial class SomeOtherPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
    }
}

SomeOtherPage.aspx.designer.cs:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace Backlog_11412_Skeleton {
     
     
    public partial class SomeOtherPage {
    }
}

Web.config:

<?xml version="1.0"?>
 
<!--
  For more information on how to configure your ASP.NET application, please visit
  -->
 
<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.0" />
 
      <pages>
        <controls>
          <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
        </controls>
      </pages>
 
      <httpHandlers>
        <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
      </httpHandlers>
       
    </system.web>
 
  <system.webServer>
    <defaultDocument enabled="true">
      <files>
        <add value="WebForm1.aspx" />
      </files>
    </defaultDocument>
 
    <validation validateIntegratedModeConfiguration="false" />
 
    <handlers>
      <remove name="Telerik_Web_UI_WebResource_axd" />
      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
    </handlers>
 
  </system.webServer>
</configuration>

 

 

 

 

 

 

0
Maria Ilieva
Telerik team
answered on 23 Aug 2016, 02:21 PM
Hi,

Can you please try to add the whole MultiPage control into the RadAjaxMnager settings instead of adding the TreeList independently and see if this makes any difference?

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 23 Aug 2016, 04:19 PM

I did that and it made no difference:

<telerik:RadAjaxManager runat="server" ID="amMain" EnableHistory="False" EnablePageHeadUpdate="False"
    UpdatePanelsRenderMode="Block" EnableAJAX="True">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="mpMain">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="mpMain" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

0
Konstantin Dikov
Telerik team
answered on 29 Aug 2016, 05:43 AM
Hello Tim,

When you include the RadMultiPage in the RadAjaxSettings, you have to also include the RadTabStrip, because both controls are linked together and you should enable AJAX for them as documented in the following help topic:
Additionally, could you please ensure that there are no JavaScript errors in the browser's console and that an AJAX requests are initiated when you move between the tabs, perform the select, etc.

Looking forward to your reply with the results.


Regards,
Konstantin Dikov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 29 Aug 2016, 05:43 PM

Konstantin,

 

Do you have the ability to recreate the project yourself and run it yourself?  That was the purpose of creating a skeleton for you.  That way, we avoid this back-and-forth.

There are no JavaScript errors.  The AJAX requests are initiated.  I removed the RadMultiPage and the issue still occurs.  Here is the new code for WebForm1.aspx:

<%@ Page Language="C#" MasterPageFile="Site1.Master"
    AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Backlog_11412_Skeleton.WebForm1"
    ValidateRequest="false" EnableEventValidation="false" %>
<%@ Register TagName="DocumentFormNavigator" TagPrefix="sem" Src="~/WebUserControl1.ascx" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
</asp:Content>
 
<asp:Content ID="SheetContent" ContentPlaceHolderID="SheetContentPlaceHolder" runat="Server">
<sem:DocumentFormNavigator ID="dfnMain" runat="server" Visible="true" AjaxManager="amMain" />
 
    <asp:Button ID="cmdSave" runat="server" Text="Postback" />
 
    <telerik:RadAjaxManager runat="server" ID="amMain" EnableHistory="False" EnablePageHeadUpdate="False"
        UpdatePanelsRenderMode="Block" EnableAJAX="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="TreeList1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="TreeList1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
</asp:Content>

 

0
Kostadin
Telerik team
answered on 01 Sep 2016, 02:43 PM
Hello Tim,

Please check out the attached sample which demonstrates how to configure the ajax in order to perform an ajax request when you select an item.

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 01 Sep 2016, 05:00 PM

Kostadin,

I don't understand the purpose behind that attachment.  I looked at the code and it is mostly identical to what I gave you.  Did you attach the wrong zip file?  The files in that zip are: Default.aspx, Default.aspx.cs, WebUserControl.ascx, and WebUserControl.ascx.cs.

 

Default.aspx is mainly identical to WebForm1.aspx that I provided.  The only difference is that you didn't use a master page, and you entered script references into the RadScriptManager.  Otherwise, everything else is the same.

Default.aspx.cs is identical to WebForm1.aspx.cs.

WebUserControl.ascx is identical to WebUserControl1.ascx, except for the name.

WebUserControl.ascx.cs is identical to WebUserControl1.ascx.cs except for the name.

 

The zip file as provided still reproduces the issue since it is the same code.

 

Thanks,

Tim

0
Kostadin
Telerik team
answered on 06 Sep 2016, 08:13 AM
Hi Tim,

Indeed the sample I prepared is based on the provided code and on my side no postback is perform after you select an item. Please check out the following video which demonstrates that a ajax request is performed once you select an item.

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tim
Top achievements
Rank 1
answered on 06 Sep 2016, 04:19 PM

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" %>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="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 />
        <a href="SomeOtherPage.aspx">Navigate Away</a>
        <br />
        <br />
    </div>
 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
         <telerik:RadAjaxManager runat="server" ID="amMain" EnableHistory="False" EnablePageHeadUpdate="False"
            UpdatePanelsRenderMode="Block" EnableAJAX="true">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="mpMain">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="mpMain" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadMultiPage ID="mpMain" runat="server" CssClass="pageView" SelectedIndex="0">
            <telerik:RadPageView ID="pvForms" CssClass="pvForms" runat="server" Selected="True">
                <sem:documentformnavigator id="dfnMain" runat="server" visible="true"
                    ajaxmanager="amMain" />
            </telerik:RadPageView>
            <telerik:RadPageView ID="pvLocked" runat="server">
            </telerik:RadPageView>
            <telerik:RadPageView ID="pvDrafts" runat="server">
            </telerik:RadPageView>
        </telerik:RadMultiPage>
 
        <asp:Button ID="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

 

Tags
TreeList
Asked by
Tim
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Tim
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Kostadin
Telerik team
Share this question
or