Hi

I am facing one severe issue while loading Grid values from database. By using AjaxStoreResult class method name is ExecuteResult.
Most of the time it is working perfectly but it some cases if no of records more than 500 means (approx) it is showing error like that
'Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.' this error occured in ajaxstoreresult class. line is 'storeResponse.Data = JSON.Serialize(this.Data);'

Below mentioned code snippets i used for loading grid.

Kindly help me to fix this issue..

If above mentioned details not clear means please let me know.

Thanks in advance.

Store
<ext:Store ID="dsDashboardMasterView" runat="server" RemoteSort="true" GroupField="CrDate"
        ShowWarningOnFailure="false" WarningOnDirty="false">
        <Proxy>
            <ext:HttpProxy Url="/Dashboard/GetDashboardMasterView/" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="TESTREQUESTID" Root="data" TotalProperty="totalCount">
                <Fields>
                    <ext:RecordField Name="TESTREQUESTID" />
                    <ext:RecordField Name="TESTREQUESTNAME" />
                    <ext:RecordField Name="CrDate" />
                    <ext:RecordField Name="TestRequestType" />
                    <ext:RecordField Name="ProductType" />
                    <ext:RecordField Name="productname" />
                    <ext:RecordField Name="PriorityName" />
                    <ext:RecordField Name="Status" />
                    <ext:RecordField Name="TRSTATUS" />
                    <ext:RecordField Name="TESTREQUESTTYPE" />
                    <ext:RecordField Name="ProjectName" />
                    <ext:RecordField Name="RequestingScientist" />
                    <ext:RecordField Name="Edit" />
                    <ext:RecordField Name="Copyas" />
                    <ext:RecordField Name="View" />
                    <ext:RecordField Name="Attachments" />
                    <ext:RecordField Name="CREATEDBY" />
                    <ext:RecordField Name="APPROVALUSERID" />
                    <ext:RecordField Name="DEPTNAME" />
                    <ext:RecordField Name="BATCHTYPE" />
                    <ext:RecordField Name="editstatus" />
                    <ext:RecordField Name="PRDTYPE" />
                    <ext:RecordField Name="CREATEDDATE" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="dir" Value="DESC" />
            <ext:Parameter Name="sort" Value="CREATEDDATE" />
            <ext:Parameter Name="textvalue" Value="#{txtSearch}.getValue()" Mode="Raw" />
            <ext:Parameter Name="dropdownvalue" Value="#{cbosearchin}.getValue()" Mode="Raw" />
            <ext:Parameter Name="conditionvalue" Value="#{cbosearchCondition}.getValue()" Mode="Raw" />
            <ext:Parameter Name="startdate" Value="#{dtpStartdate}.getValue()" Mode="Raw" />
            <ext:Parameter Name="enddate" Value="#{dtpEdndate}.getValue()" Mode="Raw" />
            <ext:Parameter Name="testrequestid" Value="#{txttestid}.getValue()" Mode="Raw" />
            <ext:Parameter Name="testtype" Value="#{cbotesttype}.getText()" Mode="Raw" />
            <ext:Parameter Name="producttype" Value="#{cboProductType}.getText()" Mode="Raw" />
            <ext:Parameter Name="productname" Value="#{cboProductName}.getText()" Mode="Raw" />
            <ext:Parameter Name="priority" Value="#{cboPrioritysearch}.getText()" Mode="Raw" />
            <ext:Parameter Name="status" Value="#{cboStatus}.getText()" Mode="Raw" />
            <ext:Parameter Name="subtestid" Value="#{txtsubtestrequestid}.getValue()" Mode="Raw" />
            <ext:Parameter Name="reportnumber" Value="#{txtReportNumber}.getValue()" Mode="Raw" />
            <ext:Parameter Name="testtyperequested" Value="#{cbotesttyperequested}.getText()"
                Mode="Raw" />
            <ext:Parameter Name="batchnumber" Value="#{txtbatchnumber}.getValue()" Mode="Raw" />
            <ext:Parameter Name="packtype" Value="#{cboPackType}.getText()" Mode="Raw" />
            <ext:Parameter Name="stablitycondition" Value="#{cbostablitycondition}.getText()"
                Mode="Raw" />
            <ext:Parameter Name="userproducttype" Value="#{hdproducttype}.getValue()" Mode="Raw" />
            <ext:Parameter Name="analystreference" Value="#{txtanalystreferece}.getValue()" Mode="Raw" />
            <ext:Parameter Name="scientist" Value="#{cboscientist}.getValue()" Mode="Raw" />
            <ext:Parameter Name="projectname" Value="#{cboprojectname}.getValue()" Mode="Raw" />
            <ext:Parameter Name="batchtype" Value="#{cboBatchtype}.getValue()" Mode="Raw" />
            <ext:Parameter Name="requestingscientist" Value="#{USERNAME}.getValue()" Mode="Raw" />
            <ext:Parameter Name="subsubteststatus" Value="#{cbosubteststatus}.getValue()" Mode="Raw" />
            <ext:Parameter Name="conditionconsolvalue" Value="#{cboconditiontype}.getValue()"
                Mode="Raw" />
            <ext:Parameter Name="stage" Value="#{txtStage}.getValue()" Mode="Raw" />
            <ext:Parameter Name="noofsamples" Value="#{txtnoofsamples}.getValue()" Mode="Raw" />
        </BaseParams>
        <SortInfo Field="CREATEDDATE" Direction="DESC" />
    </ext:Store>
Controller

 public AjaxStoreResult GetDashboardMasterView(
            string dir, string sort, string textvalue,
            string dropdownvalue, string conditionvalue, string startdate, string enddate,
            string testrequestid, string testtype, string producttype, string productname,
            string priority, string status, string subtestid, string reportnumber,
            string testtyperequested, string batchnumber, string packtype, string stablitycondition,
            string userproducttype, string analystreference, string scientist,
            string projectname, string batchtype, string requestingscientist, string subsubteststatus,
            string conditionconsolvalue, string stage, string noofsamples
            )
        {
            AjaxStoreResult ajaxstoreresult = new AjaxStoreResult();
            try
            {
                #region Functional

                if (conditionvalue.Length > 0)
                {
                    var queryvalue = DashboardRepository.Instance.GetDashboardMasterViewAdvancedSearch(dir,
                        sort, GetUserProfileID.GetUserID(),
                        conditionvalue, startdate, enddate, testrequestid, testtype,
                        producttype, productname, priority, status, subtestid, reportnumber,
                        testtyperequested, batchnumber, packtype, stablitycondition,
                        userproducttype, analystreference, scientist,
                        projectname, batchtype, requestingscientist, subsubteststatus,
                        conditionconsolvalue, stage, noofsamples
                        );
                    int advtotal = queryvalue.Count();
                    return new AjaxStoreResult(queryvalue, advtotal);
                }
                var query = dropdownvalue.Length == 0 ? DashboardRepository.Instance.GetDashboardMasterView(dir,
                    sort, GetUserProfileID.GetUserID(),
                    userproducttype) :
                    DashboardRepository.Instance.GetDashboardMasterViewwithSearch(dir, sort, GetUserProfileID.GetUserID(),
                    textvalue, dropdownvalue, userproducttype);

                int total = query.Count();
                return new AjaxStoreResult(query, total);

                #endregion
            }
            catch (Exception ex)
            {
                atrtLog.LogRoutine(false, ex.ToString());
            }
            return ajaxstoreresult;
        }
Repository

 public IQueryable GetDashboardMasterViewwithSearch(string dir, string sort,
            int userid, string textvalue, string dropdownvalue, string userproducttype)
        {
            ATRTDataContext atrtdatacontext = new ATRTDataContext(Utilities.ModelConnectionString);

            try
            {
                #region Functional

                int[] ivalue = this.GetTestReqeustFillter(userid);
                int[] isearch = this.GetSearchableColumns(textvalue, dropdownvalue);

                if (ivalue.Count() >= 2000 || isearch.Count() >= 2000)
                {
                    #region Index of

                    var ivalfilter = "," + string.Join(",", ivalue) + ",";
                    var isearchfilter = "," + string.Join(",", isearch) + ",";

                    var query = (from c in atrtdatacontext.DashboardMasterViews.Where
                                     (
                                     c =>
                                     ivalfilter.IndexOf("," + c.TESTREQUESTID.ToString() + ",") != -1
                                     &&
                                     isearchfilter.IndexOf("," + c.TESTREQUESTID.ToString() + ",") != -1
                                     &&
                                     c.TRSTATUS != 3 && c.TRSTATUS != 4 && c.TRSTATUS != 5
                                     && c.ISDRAFT == false && this.GetTestRequestType(Convert.ToInt32(userproducttype)).
                                     Contains(c.TESTREQUESTTYPE)
                           )
                                 select new
                                 {
                                     c.TESTREQUESTID,
                                     c.TESTREQUESTNAME,
                                     c.CrDate,
                                     TestRequestType = c.TestType,
                                     c.ProductType,
                                     c.productname,
                                     c.PriorityName,
                                     c.Status,
                                     c.TRSTATUS,
                                     c.TESTREQUESTTYPE,
                                     c.ProjectName,
                                     c.RequestingScientist,
                                     Edit = "Edit",
                                     Copyas = "Copy as",
                                     View = "View",
                                     Attachments = "Attachments",
                                     c.CREATEDBY,
                                     c.APPROVALUSERID,
                                     c.DEPTNAME,
                                     c.BATCHTYPE,
                                     c.editstatus,
                                     c.PRDTYPE,
                                     c.CREATEDDATE
                                 }).OrderBy(string.Concat(sort, " ", dir));
                    return query;

                    #endregion
                }
                else
                {
                    #region Contains

                    var query = (from c in atrtdatacontext.DashboardMasterViews.Where(c =>
                        ivalue.Contains(c.TESTREQUESTID)
                        &&
                        isearch.Contains(c.TESTREQUESTID)
                        &&
                        c.TRSTATUS != 3 && c.TRSTATUS != 4 && c.TRSTATUS != 5
                                        && c.ISDRAFT == false && this.GetTestRequestType(Convert.ToInt32(userproducttype)).
                                        Contains(c.TESTREQUESTTYPE))
                                 select new
                                 {
                                     c.TESTREQUESTID,
                                     c.TESTREQUESTNAME,
                                     c.CrDate,
                                     TestRequestType = c.TestType,
                                     c.ProductType,
                                     c.productname,
                                     c.PriorityName,
                                     c.Status,
                                     c.TRSTATUS,
                                     c.TESTREQUESTTYPE,
                                     c.ProjectName,
                                     c.RequestingScientist,
                                     Edit = "Edit",
                                     Copyas = "Copy as",
                                     View = "View",
                                     Attachments = "Attachments",
                                     c.CREATEDBY,
                                     c.APPROVALUSERID,
                                     c.DEPTNAME,
                                     c.BATCHTYPE,
                                     c.editstatus,
                                     c.PRDTYPE,
                                     c.CREATEDDATE
                                 }).OrderBy(string.Concat(sort, " ", dir));
                    return query;

                    #endregion
                }

                #endregion
            }
            catch (Exception ex)
            {
                atrtLog.LogRoutine(false, ex.ToString());
                throw ex;
            }
        }
AjaxStoreResult

public override void ExecuteResult(ControllerContext context)
        {
            try
            {
                switch (this.ResponseFormat)
                {
                    case StoreResponseFormat.Load:
                        StoreResponseData storeResponse = new StoreResponseData();
                        storeResponse.Data = JSON.Serialize(this.Data);  //Error occured in this line..
                        storeResponse.Total = this.Total;
                        storeResponse.Return();
                        break;
                    case StoreResponseFormat.Save:
                        Response response = new Response(true);
                        response.Success = this.SaveResponse.Success;
                        response.Message = this.SaveResponse.Message;
                        StoreResponseData saveResponse = new StoreResponseData();
                        saveResponse.Confirmation = this.SaveResponse.ConfirmationList;
                        response.Data = saveResponse.ToString();
                        response.Return();
                        break;
                    case StoreResponseFormat.GenerateError:
                        Response errorresponse = new Response(true);
                        errorresponse.Success = false;
                        errorresponse.Message = this.errorstoreResponse.Message;
                        errorresponse.Return();
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }