protected void PagingT_SelectedIndexChanged(object sender, EventArgs e)
    {
        int totalRows = 0;

        pageNumber  = Convert.ToInt32(PagingT.Text);
        pageNumber -= 1;

        List <Searched_Apartment> S_Apartment_List = new List <Searched_Apartment>();

        S_Apartment_List = ApartmentDataAccessLayer.GetApartmentInfo(pageNumber, 4, out totalRows);
        if (pageNumber < totalPages - 1)
        {
            statusT1.Text = S_Apartment_List[0].location_name;
            string item1 = S_Apartment_List[0].bed.ToString() + " BedRooms";
            string item2 = S_Apartment_List[0].bath.ToString() + " BathRooms";
            //string item2 = S_Apartment_List[0].bath.ToString() + " BathRooms";
            apaI1.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[0].imageData;
            Session["ApId0"] = S_Apartment_List[0].Apartment_id.ToString();

            Label1.Text = item1;
            Label2.Text = item2;


            statusT2.Text    = S_Apartment_List[1].location_name;
            item1            = S_Apartment_List[1].bed.ToString() + " BedRooms";
            item2            = S_Apartment_List[1].bath.ToString() + " BathRooms";
            apaI2.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[1].imageData;
            Session["ApId1"] = S_Apartment_List[1].Apartment_id.ToString();


            Label3.Text = item1;
            Label4.Text = item2;

            statusT3.Text    = S_Apartment_List[2].location_name;
            item1            = S_Apartment_List[2].bed.ToString() + " BedRooms";
            item2            = S_Apartment_List[2].bath.ToString() + " BathRooms";
            apaI3.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[2].imageData;
            Session["ApId2"] = S_Apartment_List[2].Apartment_id.ToString();


            Label5.Text = item1;
            Label6.Text = item2;



            statusT4.Text    = S_Apartment_List[3].location_name;
            item1            = S_Apartment_List[3].bed.ToString() + " BedRooms";
            item2            = S_Apartment_List[3].bath.ToString() + " BathRooms";
            apaI4.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[3].imageData;
            Session["ApId3"] = S_Apartment_List[3].Apartment_id.ToString();


            Label7.Text = item1;
            Label8.Text = item2;
        }

        // PagingData(pageNumber, 4, totalRows);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Response.Write(area_name);
        if (!Page.IsPostBack)
        {
            Session["name"]  = "";
            Session["login"] = "";
        }
        if (Page.IsCallback)
        {
            if (Session["login"].ToString() == "logout")
            {
                Button4.Text = "Hi " + Session["name"].ToString();
            }
            else
            {
                Button4.Text = "Login/SignUp";
            }
        }

        /*SqlCommand cmd = new SqlCommand("GetDistrictById", conn);
         * cmd.CommandType = CommandType.StoredProcedure;
         *
         * SqlParameter Search_dist = new SqlParameter();
         * Search_dist.ParameterName = "@dName";
         * Search_dist.Value = area_name;
         * cmd.Parameters.Add(Search_dist);
         *
         * conn.Open();
         * SqlDataReader reader1 = cmd.ExecuteReader();
         * while (reader1.Read())
         * {
         *
         *   d_id = (int)reader1["DId"];
         *   //Response.Write(d_id);
         * }
         * reader1.Close();
         * conn.Close();
         */



        if (!IsPostBack)
        {
            int totalRows = 0;
            List <Searched_Apartment> S_Apartment_List = new List <Searched_Apartment>();
            S_Apartment_List = ApartmentDataAccessLayer.GetApartmentInfo(0, 4, out totalRows);


            statusT1.Text = S_Apartment_List[0].location_name;
            string item1 = S_Apartment_List[0].bed.ToString() + " BedRooms";
            string item2 = S_Apartment_List[0].bath.ToString() + " BathRooms";
            apaI1.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[0].imageData;
            Session["ApId0"] = S_Apartment_List[0].Apartment_id.ToString();

            Label1.Text = item1;
            Label2.Text = item2;

            statusT2.Text    = S_Apartment_List[1].location_name;
            item1            = S_Apartment_List[1].bed.ToString() + " BedRooms";
            item2            = S_Apartment_List[1].bath.ToString() + " BathRooms";
            apaI2.ImageUrl   = "data:Image/png;base64," + S_Apartment_List[1].imageData;
            Session["ApId1"] = S_Apartment_List[1].Apartment_id.ToString();


            Label3.Text = item1;
            Label4.Text = item2;

            /* statusT3.Text = S_Apartment_List[2].location_name;
             * item1 = S_Apartment_List[2].bed.ToString() + " BedRooms";
             * item2 = S_Apartment_List[2].bath.ToString() + " BathRooms";
             * apaI3.ImageUrl = "data:Image/png;base64," + S_Apartment_List[2].imageData;
             * Session["ApId2"] = S_Apartment_List[2].Apartment_id.ToString();
             *
             *
             * Label5.Text = item1;
             * Label6.Text = item2;
             *
             * statusT4.Text = S_Apartment_List[3].location_name;
             * item1 = S_Apartment_List[3].bed.ToString() + " BedRooms";
             * item2 = S_Apartment_List[3].bath.ToString() + " BathRooms";
             * apaI4.ImageUrl = "data:Image/png;base64," + S_Apartment_List[3].imageData;
             * Session["ApId3"] = S_Apartment_List[3].Apartment_id.ToString();
             *
             *
             * Label7.Text = item1;
             * Label8.Text = item2;*/


            PagingData(1, 4, totalRows);
        }
    }