0

I'm rendering a Comment control on one of my pages. However, it only displays 5 comments before you have to page to the next 5 comments. How do I increase this page size? There is no attribute or webpart property that I can see

<SharePointPortalControls:SocialCommentControl ID="CommentControl" runat="server" />

I have tried:

CommentControl.Attributes.Add("DisplayItems", "10");

AND

CommentControl.Attributes["DisplayItems"] =  "10";

2 Answers 2

0

This should do the trick:

PropertyInfo pi = typeof(SocialCommentControl).GetProperty("DisplayItems", BindingFlags.NonPublic | BindingFlags.Instance);
pi.SetValue(CommentControl, 10);

Valid values for DisplayItems property are 1 through 10. If you set it to less than 1 it will be considered as 1 and if you set it to more than 10 it will be considered as 10.

1
  • Just saw this, I'll give it a try Nov 19, 2014 at 18:38
0

You could directly access the backfield m_displayItems instead of using the property DisplayItems:

FieldInfo fi = typeof(SocialCommentControl).GetField("m_displayItems", BindingFlags.NonPublic | BindingFlags.Instance);
fi.SetValue(CommentControl, 1000);

This way you can use a value greater than 10 (which is restricted in the property setter).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.