[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

ViewState efficiency

It is efficient to use a view state to handle moving back to previous page.

see below:  (has to be a better way to do that

 Session["PreviousPageURL"] = "D.ASPX";

        try
        {
            m_nUserID = Profile.PA;
            m_strProviderAHID = Profile.ExtID.ToString();
        }
        catch  (Exception) //(Exception ex) trs removed 09/29/2011
        {
            //log.Error("Error n pace_Demographic:Page_Load-1, get m_nUserId and m_strProviderAHCCCSID", ex);
            //Removed trs 09/29/2011
           Session.Abandon();
            FormsAuthentication.SignOut();
            try
            {
                Response.Redirect("~/SessionTimeout.htm");
            }
            catch (ThreadAbortException)
            { }
        }

        PaceFunctions.GetPaceRoles(m_strProviderAHCCCSID, ref m_bMemberManagement, ref m_bSuperUser, ref m_bDeleteMemberRole, ref m_bUndoTransferRole);
        m_bFinancialEligibility = PaceFunctions.IsFinancialEligibility();
        m_bReadOnly = PaceFunctions.IsReadOnly();
        m_bPaceUser = PaceFunctions.IsPaceUser();
        Page.MaintainScrollPositionOnPostBack = true;
       
        if (!Page.IsPostBack)
        {
            ViewState["PaceStatus"] = Session["PaceStatus"].ToString();
            ViewState["PACEID"] = Session["PACEID"].ToString();
            ViewState["ASSESSMENTID"] = Session["ASSESSMENTID"].ToString();
            ViewState["COOLEnabled"] = "YES";
            FillDropDowns();
            LoadDemographic();
            if (ViewState["PaceStatus"].ToString() == "Add")
            {
                m_bMemberManagement = false;
                tdEdit.Visible = false;
                tdEdit2.Visible = false;
                btnDelete.Visible = false;
                tdSave.Visible = true;
                tdSave2.Visible = true;
                ddlStage.SelectedIndex = -1;
                SetControlState("Enabled");
            }
            else
            {
                tdSave.Visible = false;
                tdSave2.Visible = false;
            }

            if (ViewState["PaceStatus"].ToString() == "Edit")
            {
                SetControlState("Disabled");
                //CPSA-721 JCALL 2-7-05
                //CPSA-862 JCALL 4-20-05 allow superusers to edit archived demographics
                if ((lblStage2.Text == " Current Stage: 11 - Archived" & m_bSuperUser == false) || (lblStage2.Text == " Current Stage: 08 - Disenrolled" && m_bSuperUser == false))
                {
                    btnEdit.Visible = false;
                    btnEdit2.Visible = false;
                }

                if (m_bDeleteMemberRole == false)
                    btnDelete.Visible = false;
            }
            if (m_bMemberManagement || m_bSuperUser)
            {
                tblMemberServices.Visible = true;
                lblStage.Visible = false;
                ddlStage.Visible = true;
            }
            else
            {
                tblMemberServices.Visible = false;
                lblStage.Visible = true;
                ddlStage.Visible = false;
            }

            trClose.Visible = false;
            trClose2.Visible = false;
            trSaveConfirm.Visible = false;
            trSaveConfirm2.Visible = false;

            Session["LastMMPage"] = "Demographic";
            string smsg = IsMissingProvider().ToString();
            if (smsg != "")
            {
                lblMessage.Visible = true;
                lblMessage.Text = lblMessage.Text + "  " + smsg.ToString();
            }

        }

        if (m_bReadOnly)
        {
            tdEdit.Visible = false;
            tdEdit2.Visible = false;
            tdSave.Visible = false;
            tdSave2.Visible = false;
        }

    }
0
TimSweet220
Asked:
TimSweet220
1 Solution

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now