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

Forums / Designing with Sitefinity / Paging for News-Comments

Paging for News-Comments

15 posts, 0 answered
  1. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    28 Jul 2009
    Link to this post
    Hi,
    I am using Comments functionality in news module. Default structure of "CommentsList.ascx" displays all the comments of a article, on a single page.
    Can I Implement paging to display those comments???

    Thanx..
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Jul 2009
    Link to this post
    Hello shraddha,

    All posts are displayed by a Repeater control. The only way to keep the current appereance is implementing paging for the repeater control. You need to create methods for calculating and returning start and end indexes of the comment list. Then get the comments for selected news item. You can use GetComments(sortExp, int StartRowIndex, int MaxRowIndex)

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    29 Jul 2009
    Link to this post
    Hi Ivan,
    Thanx for the suggestion. We will try the same and let you know.
    One more thing that we have observed in comment functionality that, when we post any comment then comment gets added but after posting when we refresh the page, same comment gets posted again.
    What can be done to avoid posting of entry multiple times.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Jul 2009
    Link to this post
    Hello shraddha,

    Generally this cannot be avoided and when you click refresh the browser asks you whether you want to proceed or no. There could be a possible solution to store the session after the first submit. In the submit button event, the sessions and the page tokens are compared. If they do not match then proceed.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    29 Jul 2009
    Link to this post
    But "Post reply" button code is not accessible by us then how can we put condition before that....

    thanx
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Jul 2009
    Link to this post
    Hello shraddha,

    You need to override CommentsList class and enhance it. You should override InitializeControls method and subscribe for the button command

    this.SubmitButton.Command += new CommandEventHandler(this.SubmitButton_Command);

    Then replace the default control with your custom one.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    29 Jul 2009
    Link to this post
    Hi Ivan,
    Thanx for the help. But can you please explain me in detail, how and where do I override this class and method to get required results.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Jul 2009
    Link to this post
    Hello shraddha,

    Below you can find a sample code:

    using System.Web.UI.WebControls; 
    using Telerik.Cms.Engine.WebControls; 
     
    /// <summary> 
    /// Summary description for CustomComments 
    /// </summary> 
    public class CustomComments : CommentsList 
        public CustomComments() 
        { 
            // 
            // TODO: Add constructor logic here 
            // 
        } 
     
        protected override void InitializeControls(System.Web.UI.Control controlContainer) 
        { 
            base.InitializeControls(controlContainer); 
            this.SubmitButton.Command +=new System.Web.UI.WebControls.CommandEventHandler(SubmitButton_Command1); 
        } 
     
        private void SubmitButton_Command1(object sender, CommandEventArgs e) 
        { 
            //add logic here 
        } 
     


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    30 Jul 2009
    Link to this post
    Hi Ivan,
    Do I need to change and or add anything in web.config???
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Jul 2009
    Link to this post
    Hi shraddha,

    You should use this control instead of default commentsList declared in presentation mode templates - ListPageMaster and ListPageDetails.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  11. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    30 Jul 2009
    Link to this post
    Hi Ivan,
    Thanx but I have CommentList control called in ListPageDetails.acsx as

    <

     

    sfWeb:CommentsList ID="commentsList" LayoutTemplatePath="~/Sitefinity/ControlTemplates/News/CommentsList.ascx"

     

     

    runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo" >

     

     

    </sfWeb:CommentsList>

    What do I change in it, so that it will use "CustomComments"

     

  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Jul 2009
    Link to this post
    Hello shraddha,

    Here is a line from my previous post.

    "You should use this control instead of default commentsList declared in presentation mode templates"

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  13. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    31 Jul 2009
    Link to this post
    HI Ivan,

    <sfWeb:CustomComments ID="commentsList" LayoutTemplatePath="~/Sitefinity/ControlTemplates/News/CommentsList.ascx" 
            runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">  
        </sfWeb:CustomComments> 

    This is giving error... Do we need to do anything additional to it??


    Thanx...
  14. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Jul 2009
    Link to this post
    Hi shraddha,

    What kind of error you are getting. May I see the code you are using?

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  15. Nisha
    Nisha avatar
    17 posts
    Registered:
    17 Jun 2009
    04 Aug 2009
    Link to this post
    Hi,
    As per your post on july 28  as stated below ,can u help me with calculating  methods for start index and end index for paging and where to implement it.


    Posted on Jul 28


    All posts are displayed by a Repeater control. The only way to keep the current appereance is implementing paging for the repeater control. You need to create methods for calculating and returning start and end indexes of the comment list. Then get the comments for selected news item. You can use GetComments(sortExp, int StartRowIndex, int MaxRowIndex)

    Thanx...
    Regards,
    Shreya
Register for webinar
15 posts, 0 answered