NullReferenceExceptions objects creating new module

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/21/2011 5:38:53 AM
Gravatar
Total Posts 20
ScalSan

Re: NullReferenceExceptions objects creating new module

OK, thanks for reminding me of the basics of asp.net and markup...  Should have known that.

Still struggling though: isn't giving exception messages anymore on the SetupEditor but the edComment control is still null, instead the null exception comes on the line that adds the event handler on the button.  I think log4net suddenly catches the error (suddenly)

Moved up this method higher in the Oninit method: SiteUtils.SetupEditor(edComment); didn't help either !

Must still be missing or forgetting something...

Selecting the control with 'this.controlid' is working.  I suppose this means that all controls are present and correct names are used in code

Noticed that when I also use the 'this-object' of the page there's mentionned as base class while debugging: {ASP.name1app_name2withmoduleinit_ascx} where there's for the guestbook: {ASP.guestbook_guestbook_ascx} --> same control and featurename

Something tells me this is wrong and this is also the only difference I can find; In the codesmith definitions I must have most likely set these different names (to see the difference in functionality aftwerwards which is maybe blocking me now)

How can I fix this?  The  partial class name of my control already reflects the control name....

8/22/2011 1:52:55 PM
Gravatar
Total Posts 18439

Re: NullReferenceExceptions objects creating new module

It should be

SiteUtils.SetupEditor(this.edComment, true, Page);

not

SiteUtils.SetupEditor(edComment);

if you get null reference exception with the code as I posted and you are sure you have an <mpe:Editor control declared in your .ascx file then it must not be using the correct .ascx file at runtime.

If you don't have an editor control declared that would also cause it but if you do and it is not seeing it then it isn't using the .ascx file you think it is using. Make sure your post build event is copying that control where it needs to go under Web and make sure it is configured to use the correct .ascx path in the FeatureDefinition file or under Administration > Advanced Tools > Feature Installation.

Hope that helps,

Joe

8/23/2011 9:23:24 AM
Gravatar
Total Posts 20
ScalSan

Re: NullReferenceExceptions objects creating new module

I used "SiteUtils.SetupEditor(this.edComment, true, Page);",  the correct overload before and it didn't work.

After my restart (new project) I indeed forgot to change this method with this overload. 
But am not sure this was the (only) problem --> I also removed the feature definition in the Admin menu and have run setup again ....AND...

IT WORKS :)

Thanks a million Joe!

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