Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to prevent load issue on page load event?

On the page load event time out issue is occurring .On increasing the connection time out no issue is seen there. I replicated the same by adding bulk data but there is no time out issue as such . The execution PLAN is seen fine though.


XML
#region Page_Load
    /// <summary>
    /// To load the page
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    protected void Page_Load(object sender, EventArgs e)
    {


        if (!IsPostBack)
        {
            curPage = 0;
            txtFromValueDate.Text = "";
            txtToValueDate.Text = "";
            txtFromValueDate.Text = Common.GetSearchFromDate().ToString("dd/MM/yyyy");
            txtToValueDate.Text = Common.GetSearchToDate().ToString("dd/MM/yyyy");

            //ViewState["DetailTable"] = grdOutward.DataSource;
            LoadOutwardGrid(curPage, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));
            LoadInwardGrid(curPage, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));
        }
        else
        {
            if (Session["DEPT_CHANGED"] == "1")
            {
                curPage = 0;
            }
            if (grdOutward.Items.Count > 0)
            {
                for (int i = 0; i < grdOutward.Items.Count; i++)
                {
                    CheckBox chk = new CheckBox();
                    chk = (CheckBox)grdOutward.Items[i].Cells[6].FindControl("lblChkSelect");

                    if (chk == null)
                    {
                        LoadOutwardGrid(0, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));

                    }

                }


            }
            LoadInwardGrid(0, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));



        }
    }
    #endregion
Posted
Comments
njammy 13-Oct-15 5:30am    
Are either of these two methods causing a long running process or query on the database or server-side?

LoadOutwardGrid(curPage, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));
LoadInwardGrid(curPage, 10, Convert.ToInt32(Session["SELECTED_DEPT"]));

How long do they take to complete?
Sinisa Hajnal 13-Oct-15 5:35am    
Try commenting out grid loading, first one then the other. See which one takes longer. Than load it asynchronously, let page load finish while you load the grid in the background
Korathu123 13-Oct-15 9:21am    
Both Outward/Inward Process happens quite fast. Tried Asynchronously too but no issue was seen.There are bulk data present too to fetch to both Outward/inward Grid.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900