juanp2
  • Posts: 20
  • Joined: 26/09/2008
Okay.. I'm going down the integration path trying to get YAF nicely integrated into a parent project. So far so good.

This is perhaps not a 'bug' but depends on the overall design goals of the project. I'm not sure if a design goal it to allow some yaf controls to be used outside of YAF.

I've taken the EditUsersProfile control and embedded it in a web page. The intent is to allow the user to customize their forum profile, while they are customizing their profile in the parent application. Since the profile is not dependant on the page or forum per say, I assumed it would work.

It almost works, but breaks when it goes to retrieve the UserID. Tracing the code, it flows into the 'Context.cs'.

In "protected void InitUserAndPage()" it breaks at the point of

				

if ( this.Settings.CategoryID != 0 )
     categoryID = this.Settings.CategoryID;


because the this.Settings is null.

Now I'd like to change it to something like the following, so that the Context can still retrieve the UserID without needing the settings, etc.


if ( this.Settings != null ) {
     if ( this.Settings.CategoryID != 0 )
          categoryID = this.Settings.CategoryID;
}



If I do this, the control loads fine.

But without spending hours understanding the finer details, is this an accetable fix or would it be introducing more problems later?
Sponsor
test2005
  • Posts: 761
  • Joined: 12/02/2005

If your worried, inside your check for a NULL, do a type cast to make sure the value is an int, as that's what is needed.

.....the man in black fled across the desert..........and the gunslinger followed.....
Jaben
  • Posts: 2544
  • Joined: 09/10/2004
Fixed in latest version... Made "Settings" property Auto-Init.
juanp2
  • Posts: 20
  • Joined: 26/09/2008
Jaben wrote:

Fixed in latest version... Made "Settings" property Auto-Init.



A much better solution than mine! Thank you Jaben.
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved