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

Forums / Developing with Sitefinity / How to customize Sitefinity forum ViewSingleThread page?

How to customize Sitefinity forum ViewSingleThread page?

18 posts, 3 answered
  1. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    04 Nov 2010
    Link to this post
    Hi Team,

    I want to customize my single thread view page to look like as attached screen shot.

    Please check the attachment and so the needful.

    Thanks,

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Nov 2010
    Link to this post
    Hi Thavarajah,

    You can change the template located inside ~/Sitefinity/ControlTemplates/Forums/SingleForum.ascx
    All public templates for Forums module are located inside /Sitefinity/ControlTemplates/Forums/.

    Sincerely yours,
    Ivan Dimitrov
    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
    Answered
  3. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    08 Nov 2010
    Link to this post
    Thanks for ur help..

    It helped me a lot.

    I have an another question. I'm trying to customize sitefinity's SingleThread.ascx for my requirement. I need to make this in such a way that user can enter comments on each post for threads(like in Facebook).  with the existing feature I can add a comment for post but it tie with the original post and add the commented post as new post for the thread. I do not want this.

    Any help appreciated.

    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Nov 2010
    Link to this post
    Hello Thavarajah,

    The out of the box functionality does not support adding comments. You have a post that is just added to a list. You need a custom control where you get the post ID and save a comment directly to it. You have to create a custom persistence classes ( you can use Telerik Open Access or LINQ- SQL) to save the comment and post ID, so you can get/set the value on load/save.

    There is a method .GetPosts(ID,  sortOrder, visible); which you can use to get all posts for the thread. You can get the thread ID  from the QueryString. Then for each post you can get the ID and save it to the custom database table.

    All the best,
    Ivan Dimitrov
    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
    Answered
  5. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    08 Nov 2010
    Link to this post
    Thanks Ivan.
  6. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    10 Nov 2010
    Link to this post
    Thanks Ivan,

    I dnt use separate user control yet I am trying to do with existing SingleThread.ascx control.
    In order for me to show comments for thread's posts I need to get post's IDs for a thread.
    Let say there can be no of replies(post) for a thread and no of comments for a post.

    I am going to have another child repeater(SingleThread.ascx) to show comments for the posts.

    I want to know is there any out of the box features provided to find the postId. like in the following
    // <asp:Literal ID="postContent" runat="server"></asp:Literal>

    Best Regards,
    Vimal
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Nov 2010
    Link to this post
    Hello Thavarajah,

    There is method in the API - GetPosts which returns IList of IPost objects from where you can get the ID.

    Regards,
    Ivan Dimitrov
    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
  8. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    10 Nov 2010
    Link to this post
    Yes I know.

    But I am using sitefinity's SingleThread.ascx, and I see there a repeater to show all the posts for a Thread. My question is, are there any way to get Post ID from the .ascx file? for example if I want post's content I can use the following inside the repeater.
    // <asp:Literal ID="postContent" runat="server"></asp:Literal>
    like wise I want to get the post Id which I need to use to show comments.

    Thanks.
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Nov 2010
    Link to this post
    Hi Thavarajah,

    You can access the DataItem from the Repeater by subscribing for ItemDataBound event

    void allPosts_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
           var itm = e.Item.DataItem;
        }
    }


    Best wishes,
    Ivan Dimitrov
    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
    Answered
  10. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    11 Nov 2010
    Link to this post
    Thanks Ivan.. you helped me to save my lots of time!!!

    Finally I have my forum as in the attached screen shot. I did only with SingleThread.ascx. I didn't use any external user controls.

    Best regards,
    Vimal
  11. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    17 Nov 2010
    Link to this post
    Hi Ivan,

    I'm trying to get user photo to Singlethread.ascx by doing like this,
    public string GetUserImage(string userId)
    {
        MembershipUser user = Membership.GetUser(new Guid(userId));
        ProfileBase profile = ProfileBase.Create(user.UserName);
        return profile.GetPropertyValue("Photo").ToString();
    }

    problem is I could not get created a user object from
    MembershipUser user = Membership.GetUser(new Guid(userId));

    If I do like this
    MembershipUser user = Membership.GetUser(new Guid(userId));
    it will work fine and return logged in user image, I want the photo of a user who did posts. Any idea for this cause?

    Regards,
    Vimal
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Nov 2010
    Link to this post
    Hi Thavarajah,

    Inside SingleThread template there is "Repeater" control with ID="allPosts". You can access the user for each post from this repeater and get/set the image.

    Regards,
    Ivan Dimitrov
    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
  13. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    18 Nov 2010
    Link to this post
    thanks Ivan. yes I can,

    But for our purpose in the DB for owner column in the 'sf_frm_Post' table we pass our UserId(Guid) not the loginId when inserting posts so your repeater will retrieve data according to owner hence the error. so what I need is I want to pass UserId for each posts and get the posts informations programmatically.

    Thanks,
    Vimal
  14. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    18 Nov 2010
    Link to this post
    Thanks Ivan, I had a small issue in my method.. now it works fine!!
  15. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    23 Nov 2010
    Link to this post
    Hi Ivan;

    I have the following questions

    1. You can see in the attached image that I need to post reply and comment for questions, it works properly but line breaks are not recognized. what may be the cause?
    I Use this method to retrieve post  content

    public string getContent(object str)
    {
    string strOut = "";
    if(str != null)
        {     
        strOut = str.ToString();
        strOut = strOut.Replace("\n\r", "<br>");
        } 
        return strOut;   
    }
    but still the same issue persists.

    Actually, do I need to have this method?

    2. I want to be able to post HTML/Javascript contact for post reply/Comment. sitefinity does not allows to post these type of contents.

    Regards,
    Vimal
  16. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Nov 2010
    Link to this post
    Hello Thavarajah,

    This method getContent does not have any association with a post item. The IPost object has a property Content of type string  that you can use directly. If you want to parse the HTML you can use custom methods.

    You can use RadEditor for your comments section which will allow you to paste html and javascript.

    Regards,
    Ivan Dimitrov
    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
  17. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    23 Nov 2010
    Link to this post
    thanks Ivan.

    I actually past Post content to the above method which I get from IPost object.

    as per our client needs we can not use RedEditor.

    Thanks.
  18. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Nov 2010
    Link to this post
    Hi Thavarajah,

    Then you can use multiine TextBox and set its value to a Text property of a Label control or choose another appropriated method for your implementation.

    Greetings,
    Ivan Dimitrov
    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
Register for webinar
18 posts, 3 answered