Re: Creating a WebPart (beginner)
Yes you could do that but there are some other options and some pros and cons to consider.
There are 2 ways to make a WebPart as a UserControl or as a ServerControl
UserControls are easier to implement and can be re-used, but only easily within the same web application. If you have created a .ascx file it is a UserControl, it inherits from System.Web.UI.UserControl.
ServerControls are a little more work to implement because everything is implemented in code, you have a compiled class and no .ascx file. ServerControls inherit from System.Web.UI.WebControls.WebControl
To make a WebPart as a UserControl, you just create a UserControl in the normal way then implement IWebPart which is a very simple interface to implement.
To make a WebPart as a ServerControl, you create a class that inherits from System.Web.UI.WebControls.WebParts.WebPart. WebPart inherits from Part which inherits from Panel which inherits from WebControl, so it is a server control.
The SimpleWebPart.cs example is a server control. It compiles into the assembly SampleExternalWebPart.dll
To use this in mojoPortal you just have to include that dll in the bin folder then "install" it in the system using Admin > Install WebParts. However, keep in mind that this doesn't work in Medium trust because Medium trust doesn't allow the use of Reflection and we use Reflection to find and load WebParts from dlls in the bin.
The other option is to just create a UserControl.ascx that inherits from mojoPortal.Web.SiteModuleControl. SiteModuleControl already has implemented IWebPart which allows any module in mojoPortal to be used as a WebPart and made available on the MyPage feature from the Module Settings page.
Then you add this module using Admin > Feature Modules
Then you create instance of the Module in the Content Manager, click the gear next to the Instance Title and it takes you to the Module Settings, check the box to make it "Available For MyPage" and now authenticated users can add it to their personalized pages under MyPage
This option works fine in Medium trust.
Hope it helps,