+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Latest comments - Library: problem with CntPageID

Latest comments - Library: problem with CntPageID

2 posts, 0 answered
  1. Milos Tadic
    Milos Tadic avatar
    32 posts
    Registered:
    05 Nov 2009
    04 Aug 2010
    Link to this post
    Hellou folks,
    I have a little problem with image url.
    On my gallery page, I use previous and next function, and image link looks like this:


    It's ok, but I have some code to retreive latest four libraries comments, on home page

    StringBuilder link = new StringBuilder();
    Telerik.Cms.Engine.ContentManager contentManagerGallery = new Telerik.Cms.Engine.ContentManager("Libraries");
    Telerik.Libraries.LibraryManager libraryManager = new Telerik.Libraries.LibraryManager();
    IList commentsLibrary = contentManagerGallery.GetComments("DateCreated DESC", 0, 4);
    link.Append("<ul>");
     
     
    if (commentsLibrary.Count > 0)
    {
     
     
     
        foreach (Telerik.Cms.Engine.IComment commentItem1 in commentsLibrary)
        {
             
            IList listOfAllLibrary = libraryManager.GetAllLibraries();
            if (listOfAllLibrary.Count > 0)
            {
                 
                //Telerik.Blogs.IBlog theBlog = blogManager.GetBlog(commentItem.Parent.ParentID);
                Telerik.Libraries.ILibrary theLibrary = libraryManager.GetLibrary(commentItem1.Parent.ParentID);
                link.Append("<li><b>" + commentItem1.Owner + "</b> : " + commentItem1.Text.Substring(0, Math.Min(commentItem1.Text.Length, 90)) + "<a href=http://localhost/sitefinity/galerija.aspx?GalleryProv=Libraries&GalleryItem=" + commentItem1.Parent.ID.ToString() + " Target=_blank><b>...more>></b></a></li>");
                
            }
        }
        link.Append("</ul>");
        komentari1.Text = link.ToString();
     
    }

    Everything works fine, but how to pass cntpageID to stringbuilder?

    link.Append("<li><b>" + commentItem1.Owner + "</b> : " + commentItem1.Text.Substring(0, Math.Min(commentItem1.Text.Length, 90)) + "<a href=http://localhost/sitefinity/galerija.aspx?GalleryProv=Libraries&GalleryItem=" + commentItem1.Parent.ID.ToString() + "&CntPageID=" + someValue??? + " Target=_blank><b>...more>></b></a></li>");

    Any suggestion?
    Thanks a lot.
    ___________________
    Best regards,
    Milos.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Aug 2010
    Link to this post
    Hello Milos Tadic,

    Thank you for using our services.

    The content page id is calculated based on that how many items per page you have set your gallery control to have and what is the index of the content item in the set of results you are going to display in the image gallery control. So for example if you have 10 items per page in the Image Gallery and the index of the image is 11 this means that it is going to appear on the second page. So to properly get the CntPageID you will need to calculate how many images will be shown in the Image Gallery control, and based on its sorting settings find the index of the respective image and calculate the value.

    On the other side if you disable paging from the control properties -> Paging section the CntPageID property will not be included in the url.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered