예제 #1
0
        // *********************************************************************
        //  InitializePostListControlTemplate
        //
        /// <summary>
        /// Render the post list view
        /// </summary>
        ///
        // ********************************************************************/
        private void InitializePostListControlTemplate()
        {
            // Initialize common display elements
            InitializeCommonTemplateItems();

            // Find the postList control
            postList = (PostList)controlTemplate.FindControl("PostList");

            // Ascending or descending
            sortOrder = (DropDownList)controlTemplate.FindControl("SortOrder");
            if (sortOrder != null)
            {
                if (user != null)
                {
                    sortOrder.Items.FindByValue(Convert.ToInt32(user.ShowPostsAscending).ToString()).Selected = true;
                }


                sortOrder.AutoPostBack          = true;
                sortOrder.SelectedIndexChanged += new System.EventHandler(SortOrder_Changed);
            }

            // Find the pager
            pager = (Paging)controlTemplate.FindControl("Pager");
            pager.PageIndex_Changed += new System.EventHandler(PageIndex_Changed);

            // Get the total records used in the pager
            pager.TotalRecords = Threads.GetTotalPostsForThread(PostID);

            // Set up the email tracking check changed event
            postList.ThreadTracking_Changed += new System.EventHandler(Toggle_ThreadTracking);

            // Set the datasource
            // If we're in a post back someone else probably wants to render the view
            // Set the datasource
            if (user != null)
            {
                postList.DataSource = Posts.GetThreadByPostID(PostID, pager.PageIndex, pager.PageSize, 0, Convert.ToInt32(user.ShowPostsAscending));
                Posts.MarkPostAsRead(PostID, user.Username);
            }
            else
            {
                postList.DataSource = Posts.GetThreadByPostID(PostID, pager.PageIndex, pager.PageSize, 0, Convert.ToInt32(sortOrder.SelectedItem.Value));
            }
            postList.DataBind();
        }
예제 #2
0
 // *********************************************************************
 //  PageIndex_Changed
 //
 /// <summary>
 /// Event raised when the selected index of the page has changed.
 /// </summary>
 ///
 // ********************************************************************/
 private void PageIndex_Changed(Object sender, EventArgs e)
 {
     // Set the datasource
     postList.DataSource = Posts.GetThreadByPostID(PostID, pager.PageIndex, pager.PageSize, 0, Convert.ToInt32(sortOrder.SelectedItem.Value));
     postList.DataBind();
 }
예제 #3
0
        // *********************************************************************
        //  InitializePostListControlTemplate
        //
        /// <summary>
        /// Render the post list view
        /// </summary>
        /// 
        // ********************************************************************/
        private void InitializePostListControlTemplate()
        {
            // Initialize common display elements
            InitializeCommonTemplateItems();

            // Find the postList control
            postList = (PostList)controlTemplate.FindControl("PostList");

            // Find the pager
            pager = (Paging)controlTemplate.FindControl("Pager");
            pager.PageIndex_Changed += new System.EventHandler(PageIndex_Changed);

            // Get the total records used in the pager
            pager.TotalRecords = Threads.GetTotalPostsForThread(PostID);
            pager.TotalPages = Paging.CalculateTotalPages(pager.TotalRecords, pager.PageSize, Threads.GetTotalPinnedPostsForThread(PostID));

            // Set up the email tracking check changed event
            postList.ThreadTracking_Changed += new System.EventHandler(Toggle_ThreadTracking);

            postList.DataSource = Posts.GetThreadByPostID(PostID, pager.PageIndex, pager.PageSize);
            postList.DataBind();
        }