Using feature settings on MyPage

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.
6/24/2011 11:12:01 PM
Gravatar
Total Posts 9

Using feature settings on MyPage

Greetings all -

I'm a new convert from DNN and so far I love everything about this; coding for MP is so much easier.  And while I've been able to convert pretty much everything over from DNN, I am having a small problem with modules accessing feature settings from MyPage.  

For example, I have a module that gets sports information based on a feature setting. What I want to do is to make the module available to users on their MyPage.  I have added the new feature to a regular page and set the feature settings to "MLB"; I then went and checked the "Available to MyPage" check box and saved it.  The feature works well on the regular page, however, when I add it to MyPage, I get "Object not set to the instance of an object" when trying to get Settings["SettingName"].  Is there something I need to do in my code differently to handle MyPages?

I hope this makes sense.  And thanks in advance for any help.

 

6/25/2011 5:28:28 PM
Gravatar
Total Posts 9

Re: Using feature settings on MyPage

I figured out my problem.  I wasn't checking for null on Settings["SettingName"] prior to using it.  Once I did that, it ran through the method twice and and the second time through it caught the correct setting and it works like a champ now.

6/27/2011 7:47:30 AM
Gravatar
Total Posts 18439

Re: Using feature settings on MyPage

If you review the latest code for existing features you'll see that in most of them we have wrapped up all the settings into a class where we pass in the hashtable of settings to the contstructor and get all the settings onto properties to make them easier to use. For example if you look at the code for the Contact Form you will see we use ContactFormConfiguration.cs

If you create an instance of it like


ContactFormConfiguration config = new ContactFormConfiguration();

it will have the default vlaues for settings and if you pass in the settings hashtable like


ContactForm Configuration config = new ContactFormConfiguration(Settings);


it will override the defaults with the feature instance values.

This is just a way to make the code cleaner and more re-usable if the custom feature has supporting pages where you also need the settings.

Hope that helps,

Joe

7/1/2011 2:48:17 PM
Gravatar
Total Posts 9

Re: Using feature settings on MyPage

Hi Joe -

That does help.  I have incorporated that functionality into all my coded pages (where needed).

Thanks!

Andy

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