Add Settings to Feature

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.
7/21/2011 3:23:20 PM
Gravatar
Total Posts 199

Add Settings to Feature

Now that I have my simple feature running I wanted to add two simple settings to it.  I have it all done but it will not build because "settings does not exist in the current context" is there a specific reference I need to get this to build?

 

private void LoadSettings()
        {

            if (Settings.Contains("setting1"))
            {
                setting1 = Settings["setting1"].ToString();
            }

            if (Settings.Contains("setting2"))
            {
                setting2 = Settings["setting2e"].ToString();
            }

           

        }

7/21/2011 3:34:50 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Add Settings to Feature

using mojoPortal.Web;

I will update the Module Settings - A Developer Convenience document with this information.

Jamie

7/21/2011 3:46:29 PM
Gravatar
Total Posts 18439

Re: Add Settings to Feature

I think the problem is that you are not inheriting from SiteModuleControl in the code behind for your feature, you are just inheriting from UserControl, to get Settings you need to inherit from SiteModuleControl

Hope that helps,

Joe

7/21/2011 3:52:26 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Add Settings to Feature

Thanks for that update, Joe. I always inherit from SiteModuleControl in my development, so I forgot about that distinction.

7/21/2011 3:57:53 PM
Gravatar
Total Posts 199

Re: Add Settings to Feature

Yes that was it and it builds fine.  Moving on to trying it out.

Was

public partial class FormWithSettings : System.Web.UI.UserControl
    {

 

 

now is

public partial class FormWithSettings : SiteModuleControl
    {

7/21/2011 4:34:17 PM
Gravatar
Total Posts 199

Re: Add Settings to Feature

I went to add settings using the admin but was unable because i did not have a resource file and got a huge error about culture.  Should I just copy a resource file into my project and always have it POST BUILD to the App_GlobalResources?

What resource file represents the english language that I can copy?

7/22/2011 11:49:27 AM
Gravatar
Total Posts 18439

Re: Add Settings to Feature

If your project doesn't already have an App_GlobalResources folder then right click the project node and choose Add > Add ASP.NET Folder > App_GlobalResources

Then right click your App_GlobalResources folder and choose Add New Item

Create YourResources.resx (for English we don't specify a culture code because it is the default)

Then in the Feature Settings put YourResources as the resource file name (without the .resx extension)

Then add your resource strings in your resource file.

I do recommend use post build event to copy the .resx file, as well as your dll and .ascx file(s)

The name of your module Setting is what you use for the resource key, it cannot have any spaces in it, but the associated string can have spaces.

Hope that helps,

Joe

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