Change the Layout of Messageboard

Siavash Mortazavi asked on October 20, 2015 18:14

Hello,

I would like to change the layout of messageboard on this page, to bring the subscription form to the top: https://community.binarytree.com/menu/community/message-board-(1).aspx

It's a Kentico 7 website, I cannot see such an option on the config, or layout page. Could you please tell me what s the procedure?

Thank you, Sia

Correct Answer

Siavash Mortazavi answered on October 21, 2015 16:06

Thanks to a colleague, here is the way to edit the layout:

  • ~/CMSWebParts/MessageBoards/MessageBoard.ascx doesn't contain the layout that builds the content of this webpart.
  • ~/CMSWebParts/MessageBoards/MessageBoard.ascx.cs doesn't have the code that builds the layout markup.
  • So, it cannot be addressed here. Going back to MessageBoard.ascx, a module is registered on top: ~/CMSModules/MessageBoards/Controls/MessageBoard.ascx
  • Navigate to that file in Visual Studio, This is the file that defines the layout for this webpart.
  • Create a new copy of this module in the same folder (Never change an original webpart or module, in-place), and change the layout.
  • Now you can clone the MessageBoard webpart and make it to address this new module, but the easier solution is:
  • Open the config dialog of the messageboard web part on the design tab of your Kentico admin page.
  • Go to the layout tab, and create a new layout that is pointing to the new module.
1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on October 20, 2015 18:26

You could create a new webpart layout OR clone the base controls and make modifications to those controls and register them within the UI to use on the website.

1 votesVote for this answer Mark as a Correct answer

Siavash Mortazavi answered on October 20, 2015 19:02 (last edited on October 20, 2015 22:07)

Actually, I tried this solution before, but the layout is currently empty: https://drive.google.com/open?id=0B5h41uO0sWKyQ3dVRFpYbUg5Rjg

Opening the webpart MessageBoard.ascx in the Visual Studio has also just this element: <cms:MessageBoard ID="msgBoard" runat="server" /> .

Looking into ascx.cs is not helping me as well, I cannot see the PrepareLayout and Append methods to figure out how the webpart is composed.

In other words, how can I know the required asp.net and Kentico elements to include in the new layout to make it work?

Could you please help more?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 21, 2015 14:14

If you're opening it in Visual Studio you must not have followed the link I posted in my previous answer. I'd suggest reading the documentation prior to doing any work in Visual Studio.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.