protected void lnkbtn_EditProfile_Click(object sender, EventArgs e)
        {
            // string navurl = DotNetNuke.Common.Globals.NavigateURL(tabid, "", query);
            //HttpContext.Current.Response.Redirect(navurl);
            lnkbtn_UpdateProfile.Visible = true;
            lnkbtn_EditProfile.Visible = false;
            lnkbtn_editProfileSettings.Visible = false;

            lnkbtn_ChangePassword.Visible = false;

            Ourspace_Utilities.View util = new Ourspace_Utilities.View();

            if (!util.IsFacebookUser(UserId))
            {
                txt_FirstName.Visible = true;
                txt_LastName.Visible = true;

                txt_FirstName.Text = lbl_FirstNameValue.Text;
                txt_LastName.Text = lbl_LastNameValue.Text;

                lbl_FirstNameValue.Visible = false;
                lbl_LastNameValue.Visible = false;

                lnkbtn_ChangePhoto.Visible = true;
            }

            //pnlEditDate.Visible = true;

            txt_City.Visible = true;
            txt_City.Text = lbl_CityValue.Text;
            lbl_CityValue.Visible = false;
            ddlCountries.Visible = true;
            lbl_CountryValue.Visible = false;

            txt_DOB.Visible = true;

            // txt_DOB.Text = lbl_AgeValue.Text;

            ListController lc = new ListController();

            ListEntryInfoCollection leic = lc.GetListEntryInfoCollection("Country", "", "");
            ddlCountries.DataTextField = "Text";
            ddlCountries.DataValueField = "Value";
            ddlCountries.DataSource = leic;
            ddlCountries.DataBind();

            int selectedIndex = 0;
            int i = 0;
            foreach (ListItem item in ddlCountries.Items)
            {

                if (item.Text == lbl_CountryValue.Text)
                {
                    selectedIndex = i;
                }
                i++;
            }
            ddlCountries.SelectedIndex = selectedIndex;
            lnkbtn_cancel.Visible = true;
            // lnkbtn_ChangePhoto.Visible = false;
            //ddlCountries.Items.Insert(0, new ListItem("Select Country", "-1"));
        }
        protected void lnkbtn_UpdateProfile_Click(object sender, EventArgs e)
        {
            // UserInfo.Profile.InitialiseProfile(PortalSettings.PortalId);

            //DateTime newDob = DateTime.Parse(hdnfld_DOB.Value);
            //string result = newDob.ToString();
            // UserInfo.Profile.SetProfileProperty("DOB", newDob.ToString());

            UserInfo.Profile.SetProfileProperty("City", txt_City.Text);
            UserInfo.Profile.SetProfileProperty("Country", ddlCountries.SelectedItem.Text);
            //UserInfo.Profile.SetProfileProperty("Website", txt_Website.Text);
            // UserInfo.Profile.SetProfileProperty("Biography", txt_AboutMe.Text);
            Ourspace_Utilities.View util = new Ourspace_Utilities.View();
            bool testing = util.IsFacebookUser(UserId);

            if (!util.IsFacebookUser(UserId))
            {
                UserInfo.Profile.SetProfileProperty("FirstName", txt_FirstName.Text);
                UserInfo.Profile.SetProfileProperty("LastName", txt_LastName.Text);
            }
            //  DotNetNuke.Security.Profile;
            DotNetNuke.Entities.Users.UserController.UpdateUser(0, UserInfo);

            // DotNetNuke.Entities.Profile.ProfileController.

            DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(UserInfo);
            var test = UserInfo.Profile.ProfileProperties;

            lbl_FirstNameValue.Text = UserInfo.Profile.FirstName;
            lbl_LastNameValue.Text = UserInfo.Profile.LastName;
            string dob = UserInfo.Profile.GetPropertyValue("DOB");
            if (UserInfo.Profile.ProfileProperties.GetByName("DOB") != null)
            {
                // lbl_AgeValue.Text = String.Format("{0:MMMM d, yyyy}", DateTime.Parse(UserInfo.Profile.ProfileProperties.GetByName("DOB").PropertyValue));
            }
            lbl_CityValue.Text = UserInfo.Profile.GetPropertyValue("City");
            lbl_CountryValue.Text = UserInfo.Profile.Country;

            lbl_CityValue.Visible = true;
            txt_City.Visible = false;

            lbl_CountryValue.Visible = true;
            ddlCountries.Visible = false;

            lbl_FirstNameValue.Visible = true;
            txt_FirstName.Visible = false;

            lbl_LastNameValue.Visible = true;
            txt_LastName.Visible = false;

            // lbl_AgeValue.Visible = true;

            //pnlEditDate.Visible = false;

            lnkbtn_cancel.Visible = false;
            lnkbtn_UpdateProfile.Visible = false;
            lnkbtn_EditProfile.Visible = true;

            Response.Redirect(Request.Url.ToString());
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                hdnfld_UserID.Value = UserId.ToString();

                string url = "";
            //string[] parameters = new string[3];
            //parameters = new string[1] { "user="******"");
               // hprlnkLogin.NavigateUrl = url;
                ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);
                ScriptReference objScriptReference;

                objScriptReference = new ScriptReference(@"~/DesktopModules/Ourspace_Friends/js/friends.js");
                objScriptManager.Scripts.Add(objScriptReference);

                Ourspace_Utilities.View util = new Ourspace_Utilities.View();
               bool isFacebookUser = util.IsFacebookUser(UserId);
               if (isFacebookUser)
               {
                   pnlNonFbInfo.Visible = false;
                   pnlFbFriends.Visible = true;
                   pnlSearchFacebookFriends.Visible = true;
               }
               else
               {
                   pnlSearchFacebookFriends.Visible = false;
                   pnlNonFbInfo.Visible = true;
                   pnlFbFriends.Visible = false;
               }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }