How do you add a web part to a WebPart content container?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/21/2008 4:04:46 PM
Gravatar
Total Posts 1

How do you add a web part to a WebPart content container?

 

I have a custom web part that I am trying to add as content on several pages but for the life of me, I can't figure out how to add it as content on a page. Here is what I've done so far (just for fun I did this with the example web part, same results):

  1. Compiled it
  2. Added the dll to the /bin directory
  3. Installed it using the Web Part Install amdin page
    Available for My Page (checked)
    Allow multiple ... (checked)
    Available for Content System (checked)
    Icon (None)
  4. Created a new page
  5. Created a new instance of a Web Part “feature” on the page in the center pane named Test WebPart

I get a new content item named Test WebPart but I can’t figure out how to then populate the content item with a web part... I searched all over the mojoPortal web site and I can't seem to find ant documentation on this...

 

 

4/21/2008 6:06:17 PM
Gravatar
Total Posts 18439

Re: How do you add a web part to a WebPart content container?

Hi Matt,

I had not looked at this in a while because I really don't use it myself. But I just looked into it and figured out the problem. It must be when I introduced the configurable installation system I forgot to configure a needed setting for this module. Here are the steps to fix it on your intallation.

1. Using a text editor open the file Web/Setup/applications/mojoportal-core/FeatureDefinitions/90400_WebPartModule.config

2. Paste this in, replacing the current content.

<?xml version="1.0" encoding="utf-8" ?>
<featureDefinitions>
<featureDefinition
featureGuid="437a19b0-ef57-4963-b311-a1e13d9d883c"
supportedDatabases="MSSQL,MySQL,pgsql,SQLite,FirebirdSql"
resourceFile="Resource"
featureNameReasourceKey="WebPartFeatureName"
controlSource="Modules/WebPartModule.ascx"
sortOrder="500"
defaultCacheTime="360"
excludeFromFeatureList="false"
icon="blank.gif"
>
<featureSetting
resourceFile="Resource"
resourceKey="WebPartModuleWebPartSetting"
defaultValue=""
controlType="TextBox"
regexValidationExpression=""
/>

</featureDefinition>
</featureDefinitions>

3. Save the file, upload to server if needed

4. Visit SiteRoot/Setup/Default.aspx to make it reconfigure this feature.

Now when you click the gear next to the title of the  WebPart moule you'll see the dropdown hopefully showing your web part.

Keep in mind that web parts that require settings don't really work in the content system because they don't have the webpart manager to manage their state. So to be usefull in the content system they need some useful default state. They work as expected in the MyPage feature but your mileage may vary in the content system depending on the web part.

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.