コード例 #1
0
ファイル: PostList.ascx.cs プロジェクト: lofourie/mojoportal
 protected string FormatEditUrl(int forumId, int threadId, int postId)
 {
     // doesn't need url encoding because NavigateUrl property on hyperlink does that for you
     return(SiteRoot + "/Forums/EditPost.aspx?pageid="
            + PageId.ToInvariantString() + "&mid=" + ModuleId.ToInvariantString()
            + "&postid=" + postId.ToInvariantString()
            + "&thread=" + threadId.ToInvariantString()
            + "&forumid=" + forumId.ToInvariantString()
            + "&pagenumber=" + PageNumber.ToInvariantString());
 }
コード例 #2
0
        private void BindRepeater()
        {
            DataTable dt = gallery.GetThumbsByPage(PageNumber, thumbsPerPage);

            if (dt.Rows.Count > 0)
            {
                TotalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]);
                itemId     = Convert.ToInt32(dt.Rows[0]["ItemID"]);
                totalRows  = thumbsPerPage * TotalPages;
            }

            //this handles issue: when redirected back to page from edit page
            //if you deleted the last image on the page an error occurs
            //so decrement the pageNumber
            while (PageNumber > TotalPages)
            {
                PageNumber -= 1;

                dt = gallery.GetThumbsByPage(PageNumber, thumbsPerPage);
                if (dt.Rows.Count > 0)
                {
                    TotalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]);
                    itemId     = Convert.ToInt32(dt.Rows[0]["ItemID"]);
                }
            }

            if (TotalPages > 1)
            {
                if (this.RenderInWebPartMode)
                {
                    if (totalRows > this.thumbsPerPage)
                    {
                        Literal moreLink = new Literal();
                        moreLink.Text = "<a href='"
                                        + SiteRoot
                                        + "/" + ViewImagePage
                                        + "?ItemID=" + itemId.ToInvariantString()
                                        + "&amp;mid=" + ModuleId.ToInvariantString()
                                        + "&amp;pageid=" + PageId.ToInvariantString()
                                        + "&amp;pagenumber=" + PageNumber.ToInvariantString()
                                        + "'>" + GalleryResources.GalleryWebPartMoreLink
                                        + "</a>";

                        this.pnlGallery.Controls.Add(moreLink);
                        pager.Visible = false;
                    }
                }
                else
                {
                    pager.ShowFirstLast = true;
                    pager.PageSize      = thumbsPerPage;
                    pager.PageCount     = TotalPages;
                }
            }
            else
            {
                pager.Visible = false;
            }


            if (UseLightboxMode)
            {
                SetupColorbox();
            }

            this.rptGallery.DataSource = dt;
            this.rptGallery.DataBind();
        }