protected void ddlPageGroups_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (fullGridViewPager == null)
     {
         fullGridViewPager = new CCLib.Common.GridCustomPager(GridViewCoaches, MaxVisible, "Page", "of");
     }
     //changes page size
     strSQL = ViewState["CommandText"].ToString();
     GridViewCoaches.PageSize = int.Parse(((DropDownList)sender).SelectedValue);
     ViewState["GVPageSize"] = int.Parse(((DropDownList)sender).SelectedValue);
     GridViewCoaches.DataBind();
     updContacts.Update();
 }
        protected void CompanyGridView_DataBound(object sender, EventArgs e)
        {
            if (fullGridViewPager == null)
            {
                fullGridViewPager = new CCLib.Common.GridCustomPager(CompanyGridView, MaxVisible, "Page", "of");
            }
            fullGridViewPager.CreateCustomPager(CompanyGridView.BottomPagerRow);
            int pageSize = CompanyGridView.PageSize;
            GridViewRow PagerRow = CompanyGridView.BottomPagerRow;
            if (PagerRow != null)
            {
                HtmlTable pagerOuterTable = (HtmlTable)PagerRow.Cells[0].FindControl("pagerOuterTable");

                int lastCellPosition = pagerOuterTable.Rows[0].Cells.Count - 1;

                DropDownList ddlPageGroups = (DropDownList)pagerOuterTable.Rows[0].Cells[lastCellPosition].FindControl("ddlPageGroups");
                if (ddlPageGroups != null)
                {
                    ListItem groupItem = new ListItem("10", "10");
                    if (pageSize == 10)
                        groupItem.Selected = true;
                    ddlPageGroups.Items.Add(groupItem);

                    ListItem groupItem1 = new ListItem("15", "15");
                    if (pageSize == 15)
                        groupItem1.Selected = true;
                    ddlPageGroups.Items.Add(groupItem1);

                    ListItem groupItem2 = new ListItem("20", "20");
                    if (pageSize == 20)
                        groupItem2.Selected = true;
                    ddlPageGroups.Items.Add(groupItem2);

                    ListItem groupItem3 = new ListItem("50", "50");
                    ddlPageGroups.Items.Add(groupItem3);
                    if (pageSize == 50)
                        groupItem3.Selected = true;
                    int intPageSize = Convert.ToInt32(ddlPageGroups.SelectedValue);

                    CompanyGridView.PageSize = intPageSize;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckNetworkAdminSession();
            #endregion Check Login

            #region Initialize Values and Form Execution
            //generate values
            string strFormID = CCLib.Common.Strings.GetFormString("FormType");
            string strDeActCompID = CCLib.Common.Strings.GetFormString("DelCompID");
            string strDeActPID = CCLib.Common.Strings.GetFormString("DeleteCoachID");

            string strMultiContact = CCLib.Common.Strings.GetFormString("MultiContact");
            string strSelectedContactID = CCLib.Common.Strings.GetFormString("SelectedContactID");
            string strSelectedCdoID = CCLib.Common.Strings.GetFormString("SelectedCdoID");
            string strCdoCount = CCLib.Common.Strings.GetFormString("CdoCount");

            if (strFormID != "")
            {
                string strDevCompanyStatusID = "";
                if (strDeActCompID != "")
                {
                    strDevCompanyStatusID = CCLib.Common.DataAccess.GetValue("select CompanyStatusID from Con_CompanyProfiles where CompanyID=" + strDeActCompID).ToString();
                }
                if (strFormID == "2")
                {
                    if ((strDeActCompID != "")&&(strMultiContact=="0"))
                    {
                        //deactive
                        //string strDevCompanyStatusID = CCLib.Common.DataAccess.GetValue("select CompanyStatusID from Con_CompanyProfiles where CompanyID=" + strDeActCompID).ToString();
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_CompanyProfiles set IsApproved=0 where CompanyID=" + strDeActCompID);
                        if (strDevCompanyStatusID != "6")
                        {
                            CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_CompanyProfiles set CompanyStatusID=4 where CompanyID=" + strDeActCompID);
                        }
                    }
                    if (strDeActPID != "")
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set PartnerStatusID=5 where PartnerUserID=" + strDeActPID);
                    }
                }
                else if (strFormID == "3")
                {
                    //delete
                    if ((strDeActCompID != "") && (strMultiContact == "0"))
                    {
                        DataTable dtCompanyLocationIDs = CCLib.Cache.GetCachedDataTable("Complocation_" + strDeActCompID, "select LocationID from Con_CompanyLocations where CompanyID=" + strDeActCompID);
                        if (dtCompanyLocationIDs.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtCompanyLocationIDs.Rows.Count; i++)
                            {
                                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyOppLocations where LocationID=" + dtCompanyLocationIDs.Rows[i]["LocationID"].ToString());
                            }
                        }
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyClusters where CompanyID=" + strDeActCompID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyLocations where CompanyID=" + strDeActCompID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyIndustries where CompanyID=" + strDeActCompID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyCareers where CompanyID=" + strDeActCompID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_MessageBoards where CompanyID=" + strDeActCompID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyOpportunities where CompanyID=" + strDeActCompID);

                        //if (strDevCompanyStatusID == "6")
                        //{
                            CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyProfiles where CompanyID=" + strDeActCompID); //}
                    }
                    if (strDeActPID != "")
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUserNameHistory where PartnerUserID=" + strDeActPID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUserAddrHistory where PartnerUserID=" + strDeActPID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CareerCoaches where PartnerUserID=" + strDeActPID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUsers where PartnerUserID=" + strDeActPID);
                    }
                }
                else if (strFormID == "5")
                {
                    //reassign Main contact
                    if ((strSelectedContactID != "") && (strDeActPID != ""))
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set IsMainCompContact=0 where PartnerUserID=" + strDeActPID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set IsMainCompContact=1, FullAccess=1 where PartnerUserID=" + strSelectedContactID);
                    }
                }
                else if (strFormID == "6")
                {
                    // reassign Potential CDO Contact
                    if ((strSelectedContactID != "") && (strDeActPID != ""))
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set IsCompanyContact=0, IsNewCDOContact=0 where PartnerUserID=" + strDeActPID);
                        CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set IsCompanyContact=1, IsNewCDOContact=1 where PartnerUserID=" + strSelectedContactID);
                    }
                }
                else //strFormID == "7"
                {
                    //reassign Existing CDO Contact
                    if ((strSelectedContactID != "") && (strSelectedCdoID != "")&&(strCdoCount!=""))
                    {
                        string[] argSelContactID=strSelectedContactID.Split(new char[] {'|'});
                        string[] argSelCDOID = strSelectedCdoID.Split(new char[] { '|' });
                        for (int i = 0; i < Int32.Parse(strCdoCount); i++) {
                            CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_CompanyOpportunities set Followup_PartnerUserID=" + argSelContactID[i].ToString() + " where OpportunityID=" + argSelCDOID[i].ToString());
                            //???????CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set IsNewCDOContact=1 where PartnerUserID=" + argSelContactID[i].ToString());
                        }
                    }
                }
                // re-initial the deletion value
                FormType.Value = ""; DeleteCoachID.Value = ""; DelCompID.Value = ""; MultiContact.Value = "";
                SelectedCdoID.Value = ""; SelectedContactID.Value = ""; CdoCount.Value = "";
            }
            //if ((strFormID == "3") && (strDeActCompID != ""))
            //{
            //    FormType.Value = "";
            //    Response.Redirect("EditCompanyProfileStatus.aspx?CompanyID=" + strDeActCompID);
            //}
            //if ((strFormID == "1") && (strDeActPID!= ""))
            //{
            //    FormType.Value = ""; DeleteCoachID.Value = "";
            //    CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set PartnerStatusID=5 where PartnerUserID=" + strDeActPID);
            //    if (!Page.ClientScript.IsStartupScriptRegistered("ChangesSaved"))
            //    {
            //        string message = "The contact has been deactivated.";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "ChangesSaved", "<script language=javascript>alert('" + message + "');</script>");
            //    }
            //}

            if (!IsPostBack)
            {
                //Initial the filter dropdown list
                fullGridViewPager = new CareerCruisingWeb.CCLib.Common.GridCustomPager(GridViewCoaches, MaxVisible, "Page", "of");
                fullGridViewPager.CreateCustomPager(GridViewCoaches.BottomPagerRow);

                Page.DataBind();
                DataTable dtContactStatus = CCLib.Cache.GetCachedDataTable("ContactSearchFilterList", "select SearchDisplayText,SearchSQL from Con_CompanyContactFilterListLookup where ConSysID=" + ConSysID + " and SearchTypeID=2");
                drpFilterList.DataSource = dtContactStatus;
                drpFilterList.DataTextField = dtContactStatus.Columns["SearchDisplayText"].ToString();
                drpFilterList.DataValueField = dtContactStatus.Columns["SearchSQL"].ToString();
                drpFilterList.DataBind();
                drpFilterList.Items.Insert(0, (new ListItem("Select", "")));

                DataTable dtSearchKeywords = CCLib.Cache.GetCachedDataTable("ContactKeywordSearchList", "select SearchDisplayText,SearchValue from Con_CompanyContactSearchLookup where ConSysID=" + ConSysID + " and SearchTypeID=2 order by IsDefault desc");
                drpSrcCriteria.DataSource = dtSearchKeywords;
                drpSrcCriteria.DataTextField = dtSearchKeywords.Columns["SearchDisplayText"].ToString();
                drpSrcCriteria.DataValueField = dtSearchKeywords.Columns["SearchValue"].ToString();
                drpSrcCriteria.DataBind();

                string strImgYes = "../media/student_parent/icons/ico_green_check.gif";
                string strImgNo = "../media/student_parent/icons/ico_red_x.gif";
                string strIsMainContact = "../media1/NetworkAdmin/ico_maincontact.gif";
                string strNotMainContact = "../media1/NetworkAdmin/ico_maincontact_blank.gif";
                string strTestLink = "/NetworkAdmin/CompanyProfile/UpdateCompanyProfile.aspx?CompanyID=";
                strSQL = " select PartnerUserID,PartnerLastName + ', ' +PartnerFirstName as Name,a.PartnerEmail, a.PartnerStatusID,(case when (a.PartnerNotes is null) then 'No note entered.' else a.PartnerNotes end) as 'PNotes',";
                strSQL += "cp.CompanyID, cp.CompanyName,case when (a.isCompanyContact=1 ) then '<a href=\"" +strTestLink +"'+CONVERT(Char,cp.CompanyID)+'\">'+cp.CompanyName+'</a>' else a.CompanyOtherName end as CompanyLink,";
                strSQL += "case when a.IsCompanyContact=1 then '" + strImgYes + "' else '" + strImgNo +"' end as ContactCheckButton,case when a.IsCareerCoach=1 then '" + strImgYes + "' else '" + strImgNo + "' end as CoachCheckButton,";
                strSQL += "case when (a.CanOfferCDOPartner = 1 OR a.CanOfferCDOCompany = 1) THEN '" + strImgYes + "' ELSE '" + strImgNo + "' END AS IsParticipatingInCDO,a.IsCompanyContact,";
                strSQL += " a.IsCareerCoach, case when (a.CanOfferCDOPartner = 1 OR a.CanOfferCDOCompany = 1) THEN 1 ELSE 0 END AS HasCDO, ";
                strSQL += " case when a.PartnerStatusID=4 then 'Active' else 'Inactive' end as Status,BackCheckStatusDescr_EN BGCheck, case when a.IsMainCompContact=1 then '" + strIsMainContact + "' else '" + strNotMainContact + "' end as MainContactIcon,l.PartnerStatusName, a.DateRegistered, CONVERT(VARCHAR(10), a.DateRegistered, 101) as FormattedDateRegistered from Con_PartnerUsers as a ";
                strSQL += " left outer join Con_CompanyProfiles as cp on cp.CompanyID=a.CompanyID and a.ConSysID=cp.ConSysID ";
                strSQL += " left join Con_BackCheckStatusLookup as b on a.BackCheckStatusID = b.BackCheckStatusID ";
                strSQL += " left join Con_PartnerStatusLookup l on a.PartnerStatusID=l.PartnerStatusID where a.ConSysID=" + ConSysID;

                ViewState["CommandText"] = strSQL;
                if (ViewState["GVPageSize"] == null)
                {
                    ViewState["GVPageSize"] = "10";
                }
            }

            strSQL = ViewState["CommandText"].ToString();
            if ((Page.IsPostBack)||(CCLib.Common.Strings.GetQueryString("src") == "1"))
            {
                string strSrcKeyword = CCLib.Common.Strings.FormatUserInput(txtSrcKeyword.Text);
                string strSrcCriteria = drpSrcCriteria.SelectedValue.ToString();
                string strSrcStatus = drpFilterList.SelectedValue.ToString();
                strSrcKeyword = (strSrcKeyword != null) ? strSrcKeyword : "";
                strSrcCriteria = (strSrcCriteria != null) ? strSrcCriteria : "";
                strSrcStatus = (strSrcStatus != null) ? strSrcStatus : "";
                if ((strSrcKeyword != "") && (strSrcCriteria != ""))
                { strSQL += " and " + strSrcCriteria + " like '%" + strSrcKeyword + "%' "; }
                if (strSrcStatus != "")
                { strSQL += " and " + strSrcStatus; }
            }
            if (CCLib.Common.Strings.GetQueryString("S") == "P")
            {
                strSQL += " and a.PartnerStatusID in (1,2,3,7)";
                drpFilterList.SelectedIndex = 5;
            }

            strSQL += " order by PartnerLastName, PartnerFirstName, DateRegistered ";
            //Response.Write(strSQL);
            sqlDataSource.ConnectionString = ConfigurationManager.AppSettings["strConLocal"];
            sqlDataSource.SelectCommand = strSQL;
            GridViewCoaches.PageSize = Int32.Parse(ViewState["GVPageSize"].ToString());
            GridViewCoaches.DataBind();
            GridViewCoaches.Columns[7].HeaderText = ConSysInfo["CDO_ShortAcronym_EN"].ToString();
            //if (!IsPostBack)
            //{
                string strPIDsTotal = "";
                DataTable dtPIDS = CCLib.Common.DataAccess.GetDataTable(strSQL);
                if (dtPIDS.Rows.Count > 0)
                {
                    for (int i = 0; i < dtPIDS.Rows.Count; i++)
                    {
                        strPIDsTotal += dtPIDS.Rows[i]["PartnerUserID"].ToString() + "|";
                    }
                }
                ViewState["PIDSCollection"] = strPIDsTotal;
            //}
            #endregion Initialize Values and Form Execution

            #region Properties For Base Class
            TitleBar=NWBrandingFullName;
            SubTitleBar = "Manage Contacts & Career Coaches";
            HasLeftButtons = false;
            StrictNoCache = false;
            #endregion Properties For Base Class
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckNetworkAdminSession();
            #endregion Check Login

            #region Initialize Values and Form Execution
            string strImgYes = "../media/student_parent/icons/ico_green_check.gif";
            string strImgNo = "../media/student_parent/icons/ico_red_x.gif";
            string strFormID = CCLib.Common.Strings.GetFormString("FormType");
            string strDeActCompID = CCLib.Common.Strings.GetFormString("DeleteCompanyID");

            if ((strFormID == "3") && (strDeActCompID != ""))
            {
                //delete
                FormType.Value = ""; DeleteCompanyID.Value = "";
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyOppLocations where opportunityid in (select opportunityid from con_companyopportunities where CompanyID=" + strDeActCompID+ ")");
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyLocations where CompanyID=" + strDeActCompID);
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyIndustries where CompanyID=" + strDeActCompID);
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyCareers where CompanyID=" + strDeActCompID);
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_MessageBoards where CompanyID=" + strDeActCompID);
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyOpportunities where CompanyID=" + strDeActCompID);
                DataTable dtCompanyLocationIDs=CCLib.Cache.GetCachedDataTable("Complocation_"+strDeActCompID,"select LocationID from Con_CompanyLocations where CompanyID=" + strDeActCompID);
                if (dtCompanyLocationIDs.Rows.Count>0)
                {
                    for (int i = 0; i < dtCompanyLocationIDs.Rows.Count; i++)
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyOppLocations where LocationID=" + dtCompanyLocationIDs.Rows[i]["LocationID"].ToString());
                    }
                }
                DataTable dtPartnerID = CCLib.Common.DataAccess.GetDataTable("select PartnerUserID from Con_PartnerUsers where CompanyID=" + strDeActCompID);
                if (dtPartnerID.Rows.Count > 0)
                {
                    for (int i = 0; i < dtPartnerID.Rows.Count; i++)
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUserNameHistory where PartnerUserID=" + dtPartnerID.Rows[i]["PartnerUserID"].ToString());
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUserAddrHistory where PartnerUserID=" + dtPartnerID.Rows[i]["PartnerUserID"].ToString());
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CareerCoaches where PartnerUserID=" + dtPartnerID.Rows[i]["PartnerUserID"].ToString());
                        CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_PartnerUsers where PartnerUserID=" + dtPartnerID.Rows[i]["PartnerUserID"].ToString());
                    }
                }
                CCLib.Common.DataAccess.ExecuteNonQuery("delete from Con_CompanyProfiles where CompanyID=" + strDeActCompID);
            }
            if ((strFormID == "1") && (strDeActCompID != ""))
            {
                //deactive
                FormType.Value = ""; DeleteCompanyID.Value = "";
                CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_CompanyProfiles set CompanyStatusID=4,IsApproved=0 where CompanyID=" + strDeActCompID);
                CCLib.Common.DataAccess.ExecuteNonQuery("Update Con_PartnerUsers set PartnerStatusID=5 where CompanyID=" + strDeActCompID);
            }

            if (!this.IsPostBack)
            {
                fullGridViewPager = new CCLib.Common.GridCustomPager(CompanyGridView, MaxVisible, "Page", "of");
                fullGridViewPager.CreateCustomPager(CompanyGridView.BottomPagerRow);
                Page.DataBind();
                // filter Data will be retrieved from new table Con_CompanyContactFilterLookup
                DataTable dtCompanyFilters = CCLib.Cache.GetCachedDataTable("CompanySearchFilterList_" + ConSysID, "select SearchDisplayText,SearchSQL from Con_CompanyContactFilterListLookup where ConSysID=" + ConSysID + " and SearchTypeID=1");
                drpFilterList.DataSource = dtCompanyFilters;
                drpFilterList.DataTextField = dtCompanyFilters.Columns["SearchDisplayText"].ToString();
                drpFilterList.DataValueField = dtCompanyFilters.Columns["SearchSQL"].ToString();
                drpFilterList.DataBind();
                drpFilterList.Items.Insert(0, (new ListItem("Select", "")));

                DataTable dtSearchKeywords = CCLib.Cache.GetCachedDataTable("CompanyKeywordSearchList_" + ConSysID, "select SearchDisplayText,SearchValue from Con_CompanyContactSearchLookup where ConSysID=" + ConSysID + " and SearchTypeID=1 order by IsDefault desc");
                drpSrcCriteria.DataSource = dtSearchKeywords;
                drpSrcCriteria.DataTextField = dtSearchKeywords.Columns["SearchDisplayText"].ToString();
                drpSrcCriteria.DataValueField = dtSearchKeywords.Columns["SearchValue"].ToString();
                drpSrcCriteria.DataBind();

                DataTable dtCompStatus = CareerCruisingWeb.CCLib.Cache.GetCachedDataTable("Con_CompanyStatusLookup_" + ConSysID, "Select * from Con_CompanyStatusLookup order by CompanyStatusID");
                StatusDDL.DataSource = dtCompStatus;
                StatusDDL.DataTextField = "CompanyStatusDesc";
                StatusDDL.DataValueField = "CompanyStatusID";
                StatusDDL.DataBind();

                if (ViewState["GVPageSize"] == null)
                {
                    ViewState["GVPageSize"] = "10";
                }

                strSQL = "SELECT ccp.CompanyID, ccp.CompanyName,  cpu.PartnerUserID, cpu.PartnerLastName+ ', ' + cpu.PartnerFirstName as 'PartnerFullName', case when ccp.HasMessageBoard=1 then '" + strImgYes + "' else '" + strImgNo + "' end as HasMsgBoard, ccp.HasMessageBoard, case when ccp.IsApproved=1 then '" + strImgYes + "' else '" + strImgNo + "' end as Status, ccp.IsApproved, ccp.CompanyStatusID";
                strSQL += " FROM Con_CompanyProfiles ccp INNER JOIN Con_PartnerUsers cpu ON ccp.CompanyID = cpu.CompanyID";
                strSQL += " WHERE ccp.ConSysID = " + ConSysID;
                strSQL += " AND cpu.IsMainCompContact = 1 and cpu.IsCompanyContact=1 and ccp.CompanyStatusID<>'6' ";
                //ViewState["CommandText"] = strSQL;
                //adding companies imported where status=1 (New)
                //strSQL = "union SELECT ccp.CompanyID, ccp.CompanyName,  cpu.PartnerLastName+ ', ' + cpu.PartnerFirstName as 'PartnerFullName', case when ccp.HasMessageBoard=1 then '" + strImgYes + "' else '" + strImgNo + "' end as HasMsgBoard, ccp.HasMessageBoard, case when ccp.IsApproved=1 then '" + strImgYes + "' else '" + strImgNo + "' end as Status, ccp.IsApproved, ccp.CompanyStatusID";
                //strSQL += " FROM Con_CompanyProfiles ccp left outer JOIN Con_PartnerUsers cpu ON ccp.CompanyID = cpu.CompanyID";
                //strSQL += " WHERE ccp.ConSysID = " + ConSysID;
                //strSQL += " AND cpp.CompanyStatusID='1' ";
                ViewState["CommandText"] = strSQL;

            }
            strSQL = ViewState["CommandText"].ToString();
            //Response.Write(strSQL);
            //if (chkActive.Checked)
            //    { strSQL += " and IsApproved=1 "; }
            if ((Page.IsPostBack)||(CCLib.Common.Strings.GetQueryString("src") == "1"))
            {
                string strSrcKeyword = CCLib.Common.Strings.FormatUserInput(txtSrcKeyword.Text);
                string strSrcCriteria = drpSrcCriteria.SelectedValue.ToString();
                string strSrcStatus = drpFilterList.SelectedValue.ToString();
                strSrcKeyword = (strSrcKeyword != null) ? strSrcKeyword : "";
                strSrcCriteria = (strSrcCriteria != null) ? strSrcCriteria : "";
                strSrcStatus = (strSrcStatus != null) ? strSrcStatus : "";
                if ((strSrcKeyword != "") && (strSrcCriteria != ""))
                { strSQL += " and " + strSrcCriteria + " like '" + strSrcKeyword + "%' "; }
                if (strSrcStatus != "")
                { strSQL += " and " + strSrcStatus; }
            }
            if (CareerCruisingWeb.CCLib.Common.Strings.IsInteger(CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("F")))
            {
                strSQL += " and (CompanyStatusID=2)";
                drpFilterList.SelectedIndex = 3;
            }

            strSQL += " ORDER BY ccp.CompanyName ASC";

            ViewState["PageSQLCommandTxt"] = strSQL;
            CompanyViewSQL.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["strConLocal"];
            CompanyViewSQL.SelectCommand = strSQL;

            CompanyGridView.PageSize = Int32.Parse(ViewState["GVPageSize"].ToString());
            CompanyGridView.DataBind();
            updCompany.Update();

            #endregion Initialize Values and Form Execution

            #region Properties For Base Class
            TitleBar=NWBrandingFullName;
            SubTitleBar = "Manage Company Profiles";
            HasLeftButtons = false;
            StrictNoCache = false;
            #endregion Properties For Base Class
        }