Note: These topics discuss customizations which apply to self-hosted Blackbaud NetCommunity websites. If Blackbaud hosts your Blackbaud NetCommunity website, please contact Blackbaud for more information about your options for customizations.
Note: These steps require Visual Studio.
Create a Parts project or open an existing one. For information about how to create a Parts project, see Create a Parts Project. Keep in mind, the DLL you build from your project will contain items used by your custom framework part type. All of the part types defined in the project will share the same DLL.
Part Properties Class
This class file is intended to hold public instances to shuttle values back and forth between the user controls for the part display and the part editor. Create a class for part properties. Name the class and class file as follows:
Class file name: <custom framework part name>Properties.vb
Class name: <custom framework part>Properties
For example if the part is called MyPart1, the class file name should be MyPart1Properties.vb and the class should look like this:
Public Class MyPart1Properties End Class
Display and Editor User Controls
The display user control is the user interface for web site users and the editor user control is the user interface for web site administrators. Add two WebuserControls to the project.
Solution Explorer > Project node > right-click menu > Add New Item > Installed > Visual Basic > Web > WebuserContol
Name the user controls as follows:
WebuserControl for part display: <custom framework part name>Display
WebuserControl for part editor: <custom framework part name>Editor
For example if the part is called MyPart1, the WebuserControls should be called MyPart1Display and MyPart1Editor. For each WebuserControl, three items will be added to the project. If Show All Files is selected for the Solution Explorer, the following files will appear in the project.
Display
MyPart1Display.ascx
Code-behind: MyPart1Display.ascx.vb
Designer: MyPart1Display.ascx.designer.vb
Editor
MyPart1Editor.ascx
Code-behind: MyPart1Editor.ascx.vb
Designer: MyPart1Editor.ascx.designer.vb
Connect the WebuserControls
Adjust the code-behind for the user controls as follows. Note these are partial classes. The designer classes are already declared as partial. The highlighted items must be adjusted for a given part.
Display
Imports BBNCExtensions Partial Public Class MyPart1Display Inherits BBNCExtensions.Parts.CustomPartDisplayBase Private mContent As MyPart1Properties Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private ReadOnly Property MyContent() As MyPart1Properties Get If mContent Is Nothing Then mContent = Me.Content.GetContent(GetType(MyPart1Properties)) If mContent Is Nothing Then mContent = New MyPart1Properties End If End If Return mContent End Get End Property End Class
Editor
Imports BBNCExtensions Partial Public Class MyPart1Editor Inherits BBNCExtensions.Parts.CustomPartEditorBase Private mContent As MyPart1Properties Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Public Overrides Function OnSaveContent(Optional ByVal bDialogIsClosing As Boolean = True) As Boolean With MyContent '.Title = txtTitle.Text End With Me.Content.SaveContent(MyContent) Return True End Function Private ReadOnly Property MyContent() As MyPart1Properties Get If mContent Is Nothing Then mContent = Me.Content.GetContent(GetType(MyPart1Properties)) If mContent Is Nothing Then mContent = New MyPart1Properties End If End If Return mContent End Get End Property End Class