protected void gvSubscribers_Sorting(object sender, GridViewSortEventArgs e)
        {
            SubscriberSortingType orderBy = SubscriberSortingType.IdAsc;

            switch (e.SortExpression)
            {
            case "Email":
                orderBy = SubscriberSortingType.EmailDesc;
                if (e.SortDirection == SortDirection.Ascending)
                {
                    orderBy = SubscriberSortingType.EmailAsc;
                }
                break;

            case "Id":
            default:
                orderBy = SubscriberSortingType.IdDesc;
                if (e.SortDirection == SortDirection.Ascending)
                {
                    orderBy = SubscriberSortingType.IdAsc;
                }
                break;
            }
            SetState("OrderBy", (int)orderBy);
            LoadSubscribers();
        }
        private void LoadSubscribers()
        {
            string email    = null;
            bool?  isActive = null;
            SubscriberSortingType orderBy = SubscriberSortingType.IdAsc;

            if (HasState(NAME_FILTER))
            {
                email = GetStringState(NAME_FILTER);
            }
            if (HasState(STATUS_FILTER) && GetStringState(STATUS_FILTER) != ANY)
            {
                isActive = Convert.ToBoolean(GetStringState(STATUS_FILTER));
            }
            if (HasState("OrderBy"))
            {
                orderBy = (SubscriberSortingType)GetIntState("OrderBy");
            }

            var result = AccountService.GetSubscriberLoadPaged(
                pageIndex: gvSubscribers.CustomPageIndex,
                pageSize: gvSubscribers.PageSize,
                email: email,
                isActive: isActive,
                orderBy: orderBy);

            if (result != null)
            {
                gvSubscribers.DataSource      = result.Items;
                gvSubscribers.RecordCount     = result.TotalCount;
                gvSubscribers.CustomPageCount = result.TotalPages;
            }

            gvSubscribers.DataBind();

            if (gvSubscribers.Rows.Count <= 0)
            {
                enbNotice.Message = "No records found.";
            }
        }