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

Forums / Developing with Sitefinity / Adding the current forum name to the top of the EditThread.ascx template

Adding the current forum name to the top of the EditThread.ascx template

4 posts, 0 answered
  1. Eric Marthinsen
    Eric Marthinsen avatar
    12 posts
    Registered:
    20 Jun 2005
    28 Oct 2010
    Link to this post
    Hello-

    I'm trying to add the name of the forum above the view where a user can create a new thread. I modified the EditThread.ascx file and added a literal for the title. Then, I added this code to the top of the template:

    <script runat ="server" type="text/C#">
     
        protected void Page_Load(object sender, EventArgs e)
        {
            this.forumTitle.Text = GetForumName();
        }
         
        static string GetForumName()
        {
            return "Forum Name";
        }
    </script>

    What I don't know how to do is get the name of the current forum. Does anyone know how I can complete the GetForumName method?

    Regards,
    Eric
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Nov 2010
    Link to this post
    Hello Eric,

    You can get the forum name if you set EditPostPage of the control. In this case the thread ID will be appended as a QueryString to the url and you will be able to retrieve the parent by using ForumID property of IPost object.

    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
  3. Eric Marthinsen
    Eric Marthinsen avatar
    12 posts
    Registered:
    20 Jun 2005
    04 Nov 2010
    Link to this post
    Hi Ivan-

    Where do I get the IPost object from? Once I have the ID of the Forum, what is the best way to retrieve the complete forum object?

    Regards,
    Eric
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Nov 2010
    Link to this post
    Hi Eric,

    The forum ID is appended to the url as a Query String - mode=singleForum&forum=a3a77927-dd22-4a1a-b202-311703435e5f, so you can get it from there by using ForumManager.GetForum(Guid forumID) which returns IForum.

    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
4 posts, 0 answered