/// <summary>
        /// Handles the Load event of Page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //isEdit = Convert.ToBoolean(Request.QueryString["isCheck"]);
            // Check session is not null
            //if (Session["candidateId"] != null)
            //{
            //    if (Session["candidateId"].ToString() != "")
            //    {
            //        candidateId = Convert.ToString(Session["candidateId"]);
            // Check page is not post back
            if (!IsPostBack)
            {
                if (isEdit)
                {
                    try
                    {
                        divCurrentEmployer.Visible = false;
                        divAddMoreJob.Visible = false;
                        divCurrntPastJobDetails.Visible = true;
                        divJobPostLookingFor.Visible = true;

                        BindIndustry();
                        BindDepartment();
                        BindFunctionalArea();
                        hfCandidateId.Value = candidateId;
                        BindRepeaterJobPostLooking();
                        BindRepeaterCurrentPastExp();

                        DataSet ds = new DataSet();
                        DataSet ds2 = new DataSet();
                        CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                        ds = currentDesiredJobBAL.ViewCurrentJobDetailsBAL(candidateId);

                        // Bind Country
                        DataSet datasetCountry = new DataSet();

                        datasetCountry = currentDesiredJobBAL.GetCountry();
                        ddlPreferredCountry.DataSource = datasetCountry;
                        ddlPreferredCountry.DataTextField = "CountryName";
                        ddlPreferredCountry.DataValueField = "CountryId";
                        ddlPreferredCountry.DataBind();

                        ddlPreferredCountry.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["PreferredCountry"]);

                        // Bind State
                        int countryId = Convert.ToInt32(ds.Tables[0].Rows[0]["PreferredCountry"]);
                        DataSet datasetState = new DataSet();
                        datasetState = currentDesiredJobBAL.GetState(countryId);
                        chklState.DataSource = datasetState;
                        chklState.DataValueField = "StateId";
                        chklState.DataTextField = "StateName";
                        chklState.DataBind();

                        string stateId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredState"]);
                        List<string> listofState = new List<string>(stateId.Split(','));
                        listofState.RemoveAll(x => x == "");

                        foreach (ListItem item in chklState.Items)
                        {
                            item.Selected = listofState.Contains(item.Value);
                        }

                        var selectedState = chklState.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtPreferredState.Text = string.Join(",", selectedState.Select(x => x.Text));

                        // Bind City
                        DataSet getcityDataSet = new DataSet();
                        getcityDataSet = currentDesiredJobBAL.GetCity(stateId);
                        chklCity.DataSource = getcityDataSet;
                        chklCity.DataTextField = "cityName";
                        chklCity.DataValueField = "cityID";
                        chklCity.DataBind();

                        string cityId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredCity"]);
                        List<string> listofCity = new List<string>(cityId.Split(','));
                        listofCity.RemoveAll(x => x == "");
                        foreach (ListItem list in chklCity.Items)
                        {
                            list.Selected = listofCity.Contains(list.Value);
                        }
                        var selectedCity = chklCity.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtCity.Text = string.Join(",", selectedCity.Select(x => x.Text));

                        // Bind CityArea
                        DataSet datasetCityArea = new DataSet();
                        datasetCityArea = currentDesiredJobBAL.GetArea(cityId);
                        chklArea.DataSource = datasetCityArea;
                        chklArea.DataValueField = "AreaId";
                        chklArea.DataTextField = "AreaName";
                        chklArea.DataBind();

                        string areaId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredArea"]);
                        List<string> listofArea = new List<string>(areaId.Split(','));
                        listofArea.RemoveAll(x => x == "");
                        foreach (ListItem list in chklArea.Items)
                        {
                            list.Selected = listofArea.Contains(list.Value);
                        }

                        var selectedarea = chklArea.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtarea.Text = string.Join(",", selectedarea.Select(x => x.Text));

                        txtResumeHeadline.Text = Convert.ToString(ds.Tables[0].Rows[0]["ResumeHeadline"]);
                        txtObjective.Text = Convert.ToString(ds.Tables[0].Rows[0]["Objective"]);
                        txtProfileSummary.Text = Convert.ToString(ds.Tables[0].Rows[0]["ProfileSummary"]);
                        lblTotalExp.Text = Convert.ToString(ds.Tables[0].Rows[0]["TotalExpriance"]);
                        txtcurrentannualsalary.Text = Convert.ToString(ds.Tables[0].Rows[0]["CurrentAnualSalary"]);
                        txtexpectedsalary.Text = Convert.ToString(ds.Tables[0].Rows[0]["ExpectedAnualSalary"]);

                        ddlWorkStatus.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["CurrentWorkingStatus"]);
                        ddlNoticePeriod.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["NoticePeriod"]);

                        string employmentstatus = Convert.ToString(ds.Tables[0].Rows[0]["EmploymentStatus"]);
                        List<string> listofemploymentstatus = new List<string>(employmentstatus.Split(','));
                        foreach (ListItem list in chklEmploymentStatus.Items)
                        {
                            list.Selected = listofemploymentstatus.Contains(list.Value);
                        }

                        //chklEmploymentStatus.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["EmploymentStatus"]);

                        string jobtype = Convert.ToString(ds.Tables[0].Rows[0]["JobType"]);
                        List<string> listjobtype = new List<string>(jobtype.Split(','));
                        foreach (ListItem list in chklJobType.Items)
                        {
                            list.Selected = listjobtype.Contains(list.Value);
                        }

                        //chklJobType.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["JobType"]);

                        string companytype = Convert.ToString(ds.Tables[0].Rows[0]["CompanyType"]);
                        List<string> listcompanytype = new List<string>(companytype.Split(','));
                        foreach (ListItem list in chklCompanyType.Items)
                        {
                            list.Selected = listcompanytype.Contains(list.Value);
                        }

                        //chklCompanyType.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["CompanyType"]);
                        rblYesNo.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["AvailabilityForInterview"]);

                        string format = Convert.ToString(ds.Tables[0].Rows[0]["BeforeTime"]);
                        string[] Words = format.Split(new char[] { ':' });
                        int count1 = 0;
                        string format1 = Convert.ToString(ds.Tables[0].Rows[0]["AfterTime"]);
                        string[] Words1 = format1.Split(new char[] { ':' });
                        int count2 = 0;

                        foreach (string Word in Words)
                        {
                            count1 += 1;
                            if (count1 == 1)
                            { ddlBeforeHours.SelectedValue = Word; }
                            if (count1 == 2)
                            { ddlBeforeMinutes.SelectedValue = Word; }
                            if (count1 == 3)
                            { ddlBeforeTime.SelectedValue = Word; }
                        }

                        foreach (string word in Words1)
                        {
                            count2 += 1;
                            if (count2 == 1)
                            { ddlAfterHours.SelectedValue = word; }
                            if (count2 == 2)
                            { ddlAfterMinutes.SelectedValue = word; }
                            if (count2 == 3)
                            { ddlAfterTime.SelectedValue = word; }
                            if (count2 == 4)
                            { ddlISTETE.SelectedValue = word; }
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                else
                {
                    CalendarExtender2.EndDate = DateTime.Now;
                    BindCountry();
                    //BindMonth();
                    //BindYear();

                    BindFunctionalArea();
                    BindIndustry();
                    BindDepartment();
                    hfCandidateId.Value = candidateId;
                    AddExperienceRecords();
                    BindExperienceGrid();
                    AddJobLookingRecords();
                    BindJobPostLookingGrid();
                }
            }
            //    }
            //}
        }