0

We have aspx page that is being used as a dialog box. Page has ascx control which has Text box to search available users from oracle DB tables. Every search click posts back to same control and renders search results.

If I click search and before response is back from server I close the dialog aspx page, then next time I try to open same dialog box it takes forever to render.

Please suggest what could be happening, going wrong? Any help is highly appreciated

Here is the code

protected void UserListControl_PreRender(object sender, EventArgs e)
{
    //set UI text
    m_objTitle.Text = TITLE_LABEL;
    //Set Properties of search
    m_objSearchResults.CacheResults = true;
    m_objSearchResults.RefreshCache = true;
    m_objSearchResults.DoSearch = true;
    m_objSearchResults.Pageable = true;
    m_objSearchResults.NoRecordsMessage = NO_RECORDS_MSG;
    m_objSearchResults.PageSize = 25;
    m_objSearchResults.SearchType = m_sSearchType;

    //Add items to the dropdown
    if (m_objStatusDropDown.Items.FindByText(AVAIL_USER_TEXT) == null)
    {
        m_objStatusDropDown.Items.Add(AVAIL_USER_TEXT);
        m_objStatusDropDown.Items.FindByText(AVAIL_USER_TEXT).Value = AVAIL_USER_VALUE;
    }

    if (m_objStatusDropDown.Items.FindByText(ALL_USER_TEXT) == null)
    {
        m_objStatusDropDown.Items.Add(ALL_USER_TEXT);
        m_objStatusDropDown.Items.FindByText(ALL_USER_TEXT).Value = ALL_USER_VALUE;
    }

    if (m_objStatusDropDown.Items.FindByText(SEARCH_USER_TEXT) == null)
    {
        m_objStatusDropDown.Items.Add(SEARCH_USER_TEXT);
        m_objStatusDropDown.Items.FindByText(SEARCH_USER_TEXT).Value = SEARCH_USER_VALUE;
    }

    if (this.Page.IsPostBack == false)
    {
        m_objStatusDropDown.SelectedValue = SEARCH_USER_VALUE;
    }
    if (IsPostBack)
    {
        try
        {
            m_objUserInstructionText.Text = "";
            //add the DAO Parameters
            string assignmentTypeSelected = Request.QueryString["AssignmentType"];
            m_objSearchResults.DAOParams.Add("RequestType", Request.QueryString["RequestType"]);
            m_objSearchResults.DAOParams.Add("AssignmentID", Request.QueryString["AssignmentID"]);
            m_objSearchResults.DAOParams.Add("AssignmentType", assignmentTypeSelected);
            m_objSearchResults.DAOParams["StatusFilter"] = m_objStatusDropDown.SelectedValue.ToUpper();
            m_objSearchResults.DAOParams["Name"] = m_objSearchTextBox.Value.Trim();
            if (null == SetApplCode(assignmentTypeSelected))
            {
                throw new ApplicationException("Invalid Assignment Type.");
            }
            else
            {
                m_objSearchResults.DAOParams["ApplCode"] = SetApplCode(assignmentTypeSelected).ToUpper();                        
            }

            //add searchControl
            m_objListPH.Controls.Add(m_objSearchResults);

            // Get the values from the ResultsForm
            string sRecordsDisplayed = m_objSearchResults.RecordsDisplayed;
            string sTableWidth = m_objSearchResults.TableWidth;
            bool bPageable = m_objSearchResults.Pageable;
            int iCurrentPageIndex = m_objSearchResults.CurrentPageIndex;
            int iPageSize = m_objSearchResults.PageSize;
            int iRecordCount = m_objSearchResults.RecordCount;
            int iEndRecord = m_objSearchResults.EndRecord;

            // Create the html if we are paging data
            m_objNavigation.Visible = bPageable;
            m_objNavigation.DisplayViewAllButton = false;
            m_objNavigation.PageSize = iPageSize;
            m_objNavigation.Count = iRecordCount;
            m_objNavigation.ItemsDisplayText = "Users";
            m_objNavigation.CurrentPage = iCurrentPageIndex + 1;
        }
        catch (ApplicationException ex)
        {
            m_objInvalidAssignTypeErr.Text = ex.Message;
            m_objUserInstructionText.Text = "";
        }
    }
}
3
  • Are you doing a postback for every single keypress? If so, you need to change this to use AJAX instead.
    – Scottie
    Dec 15, 2015 at 23:27
  • I left my crystal ball at home.. can I see your code?
    – Seany84
    Dec 15, 2015 at 23:34
  • @Seany84 I have added the code
    – miya
    Dec 15, 2015 at 23:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.