private void SortFavorites()
        {
            String sort = ddlSort.SelectedValue;

            List <FavoritesModel> favoritesList = CommunityHelper.GetFavorites(CurrentMember.MemberId);

            if (sort == UnderstoodDotOrg.Common.Constants.MyAccountSearchValues.MostRecent.ToString())
            {
                favoritesList = favoritesList.OrderByDescending(x => x.Date).ToList();
            }
            else if (sort == UnderstoodDotOrg.Common.Constants.MyAccountSearchValues.OldestToNewest.ToString())
            {
                favoritesList = favoritesList.OrderBy(x => x.Date).ToList();
            }
            else if (sort == UnderstoodDotOrg.Common.Constants.MyAccountSearchValues.NumberOfComments.ToString())
            {
                favoritesList = favoritesList.OrderByDescending(x => x.ReplyCount).ToList();
            }
            else if (sort == UnderstoodDotOrg.Common.Constants.MyAccountSearchValues.RecentComments.ToString())
            {
                favoritesList = favoritesList.OrderByDescending(x => x.RecentCommentDate).ToList();
            }

            if ((favoritesList != null) && (favoritesList.Count != 0))
            {
                pnlFavorites.Visible = true;

                rptFavorites.DataSource = favoritesList;
                rptFavorites.DataBind();
            }
            else
            {
                pnlNoFavorites.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var items = CommunityHelper.GetMyAccountFavoritesSortOptions();

                foreach (var item in items)
                {
                    ddlSort.Items.Add(new ListItem()
                    {
                        Text = item.Description, Value = item.Value
                    });
                }

                ddlSort.DataBind();

                foreach (ListItem item in ddlSort.Items)
                {
                    if (item.Value == UnderstoodDotOrg.Common.Constants.MyAccountSearchValues.MostRecent.ToString())
                    {
                        ddlSort.SelectedValue = item.Value;
                        break;
                    }
                }

                SortFavorites();
            }

            var favoritesList = CommunityHelper.GetFavorites(CurrentMember.MemberId);

            if ((favoritesList != null) && (favoritesList.Count != 0))
            {
                pnlFavorites.Visible = true;

                rptFavorites.DataSource = favoritesList;
                rptFavorites.DataBind();
            }
            else
            {
                pnlNoFavorites.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;
            var           item    = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountFavorites);

            hypFavoritesTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item);
            hypFavoritesTab.Text        = context.SeeAllFavoritesText;

            var favoritesList = CommunityHelper.GetFavorites(CurrentMember.MemberId);

            litCount.Text = favoritesList != null?favoritesList.Count.ToString() : "0";

            if ((favoritesList != null) && (favoritesList.Count != 0))
            {
                pnlFavorites.Visible    = true;
                rptFavorites.DataSource = favoritesList.Count < 3 ? favoritesList.GetRange(0, favoritesList.Count) : favoritesList.GetRange(0, 3);
                rptFavorites.DataBind();
            }
            else
            {
                pnlNoFavorites.Visible = true;
            }
        }