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

Problem with AJAX in SharePoint 2013

6 Answers 133 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Farjad
Top achievements
Rank 1
Farjad asked on 10 Apr 2016, 07:12 AM

Hi,

In a SharePoint 2013 publishing site, I've a web application page which has a RadGrid. The grid is setup to use RadAjax for CRUD operations. The problem is that when the page is left idle for a minute or so, and any postback operations is performed on the grid (e.g. clicking the add new button [grid command]) then the page's state is somehow lost. In the code behind, IsPostBack is found to be false. It behaves as if the page was refreshed.

I found something about the same issue here. As suggested, I disabled Forms Authentication but it started causing other problems in the publishing site, e.g. Access denied error for some resources.

Is there a proper solution provided to this issue? Any help will be highly appreciated.

 

Regards,
Farjad

6 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 13 Apr 2016, 01:45 PM
Hi,

Please try increasing the AsyncPostBackTimeout property of the ScriptManager/RadScriptManager in order to  define the timeout period.

I hope this helps.


Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Farjad
Top achievements
Rank 1
answered on 13 Apr 2016, 04:01 PM

Hi Maria,

I had already tried the AsyncPostBackTimeout property but it did not help which makes sense, cause the problem is not about PostBack response. As I mentioned before, when I checked in the debug mode the IsPostBack's value was false. Things work absolutely fine if the actions are performed within a minute, the problem is faced only when the page is left idle for more than a minute (or may be one and a half minute) and the form is submitted (for sorting or filtering or any other PostBack action).

It will be really helpful if the Telerik team could look into this.

 

Thanks &regards,
Farjad

0
Maria Ilieva
Telerik team
answered on 18 Apr 2016, 11:53 AM
Hi,

Try modifying the IIS TimeOut settings as shown below:
http://aspnetfaq.com/iis7-application-pool-idle-time-out-settings/

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Farjad
Top achievements
Rank 1
answered on 21 Apr 2016, 06:37 AM

Hi Maria,

The IdleTimeOut is already set to 0. In my humble opinion, that's not related to the problem anyway. I've tried to analyze the requests in fiddler and found that response to the ajax requests (made after a minute or so) is 401 UNAUTHORIZED. Could not figure out the reason or solution yet.

Thanks & regards,
Farjad

0
Farjad
Top achievements
Rank 1
answered on 21 Apr 2016, 08:25 AM

Here is a sample code which shows the problem I'm facing.

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2015.1.225.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadAjax.aspx.cs" Inherits="RadAjaxTest.Layouts.RadAjaxTest.RadAjax" DynamicMasterPageFile="~masterurl/default.master" %>
 
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
 
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <div>
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="radGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="radGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Default" />
        <div class="adc-float adc-clear" style="width: 600px;">
            <asp:HiddenField runat="server" ID="hfSelectedRowIds" />
            <telerik:RadGrid runat="server"
                ID="radGrid"
                AutoGenerateColumns="true"
                AllowSorting="True"
                AllowMultiRowSelection="true"
                AllowPaging="true"
                Skin="Metro"
                GridLines="None"
                PageSize="10"
                AllowFilteringByColumn="false"
                OnNeedDataSource="radGrid_NeedDataSource">
                <MasterTableView ClientDataKeyNames="ID"
                    DataKeyNames="ID"
                    TableLayout="Fixed">
                    <PagerStyle Mode="NextPrevAndNumeric"
                        Position="TopAndBottom"
                        AlwaysVisible="true"
                        PageSizeControlType="RadDropDownList"></PagerStyle>
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="PropA" SortOrder="Ascending" />
                    </SortExpressions>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </div>
</asp:Content>
 
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Application Page
</asp:Content>
 
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    My Application Page
</asp:Content>

 

Code behind:

using Microsoft.SharePoint.WebControls;
using System;
using System.Collections.Generic;
using Telerik.Web.UI;
 
namespace RadAjaxTest.Layouts.RadAjaxTest
{
    public partial class RadAjax : LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void radGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            IList<SomeItem> items = new List<SomeItem>();
 
            for (int i = 1; i <= 45; i++)
            {
                items.Add(new SomeItem()
                {
                    ID = i,
                    PropA = "Prop A " + i.ToString("00"),
                    PropB = "Prop B " + i.ToString("00")
                });
            }
 
            radGrid.DataSource = items;
        }
    }
 
    public class SomeItem
    {
        public int ID
        {
            get;
            set;
        }
 
        public string PropA
        {
            get;
            set;
        }
 
        public string PropB
        {
            get;
            set;
        }
    }
}

0
Maria Ilieva
Telerik team
answered on 25 Apr 2016, 01:06 PM
Hi Farjad,

I would suggest you to remove the Telerik controls and simply place regular asp controls ajaxified with asp Update Panel and see what the result in this case is.

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Ajax
Asked by
Farjad
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Farjad
Top achievements
Rank 1
Share this question
or