Welcome Guest Search | Active Topics | Log In | Register

Using Profile Settings Control... no categoryID Options · View
juanp2
#1 Posted : Monday, October 13, 2008 2:47:09 PM
Rank: Member


Joined: 9/27/2008
Posts: 20
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

Code:
                

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.

Code:

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?
test2005
#2 Posted : Tuesday, October 14, 2008 10:59:49 AM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 927
Location: Italy

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
#3 Posted : Tuesday, October 14, 2008 11:13:14 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,050
Location: Honolulu, HI
Fixed in latest version... Made "Settings" property Auto-Init.
"When you are grateful, fear disappears and abundance appears”."

juanp2
#4 Posted : Wednesday, October 15, 2008 7:15:57 AM
Rank: Member


Joined: 9/27/2008
Posts: 20
Jaben wrote:
Fixed in latest version... Made "Settings" property Auto-Init.


A much better solution than mine! Thank you Jaben.
Users browsing this topic
Guest
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.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.068 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET