Extending Profile: Object reference not set to an instance of an object

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.
8/14/2008 5:19:51 PM
Gravatar
Total Posts 33

Extending Profile: Object reference not set to an instance of an object

Hi Guys,

I am trying to add some more user profile fields into the mojoProfile.config, however when I start the website from vs2005 it complains about Object reference not set to an instance of an object

Line 74: public bool ShowWarningOnMissingKey
Line 75: {
Line 76: get { return (ViewState["ShowWarningOnMissingKey"] != null ? (bool)ViewState["UseLabelTag"] : true); }
Line 77: set { ViewState["ShowWarningOnMissingKey"] = value; }
Line 78: }

this is the field I am trying to add

<add name="IsDeveloper"
type="System.Boolean"
labelResourceKey="Is Developer"
requiredForRegistration="true"
regexValidationExpression=""
regexValidationErrorResourceKey=""
includeHelpLink="false"></add>

I have tried to rebuild the solution and still no luck, are there any other files I need to change?

Cheers!

James

8/14/2008 5:57:58 PM
Gravatar
Total Posts 33

Re: Extending Profile: Object reference not set to an instance of an object

OK, It is required to add the label key to ProfileResource.resx as well. which the documentation does not directly indicate I need to add the field label to the resource file.

8/15/2008 7:40:52 AM
Gravatar
Total Posts 18439

Re: Extending Profile: Object reference not set to an instance of an object

Hi James,

Thanks for letting me know about this. What I really need to do is add a ResourceFile property so that you can specify a custom file (so you don't have to modify mojoportal core files like Profile.resx). You will likely lose your customization of that file when you next upgrade to a new version of mojoPortal because the Profile.resx file will be overwritten. We need to make it possible to use your own resource file to really solve this. The other thing I can do is fail more gracefully and just display the key if its not found in the resource file, that way it will work even by doing what you did originally.

I'll try to get to this soon.

Best,

Joe

8/15/2008 7:59:51 AM
Gravatar
Total Posts 18439

Re: Extending Profile: Object reference not set to an instance of an object

Actually I just looked and its already there, you can put your label in your own resource file and specify it on the custom property like this:

resourceFile="MyResource"

note that the file is actually MyResource.resx but you leave off the extension.

I also looked into the error that you had in the debugger and fixed it. The fix will be in svn trunk by tonight and in the next release. The profile is supposed to let you put a label there and it just displays, using a resource file is not required, just recommended so you can localize your custom work. The problem turned out to be a bug in the SiteLabel control.

Best,

Joe

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