HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1SetProfileProperty issueSetProfileProperty issue
Previous
 
Next
New Post
9/4/2008 11:01 AM
 

I am creating a custom module for a user to create a new user for their company.  After the new user is created I pass the ID in "UserId" and try to change that users profile to match the user that is logged in "intUserId".  From all the reseach I have done the code below should work, but I get an "Object reference not set to an instance of an object" error.  I am just not seeing it, can someone please look at the code below for me and help me out.  Thank You.

Protected

Sub UpdateUserCo(ByVal UserId As Integer)'gets the properties of the company for the user logged in

 

 

 

 

 

 

 

 

 

Dim users As New UserController()Dim adUser As UserInfo = users.GetUser(0, intUserId)Dim strCo As String = adUser.Profile.ProfileProperties.GetByName("Company").PropertyValueDim strCoAdd As String = adUser.Profile.ProfileProperties.GetByName("CompanyAddress1").PropertyValueDim strCity As String = adUser.Profile.ProfileProperties.GetByName("City").PropertyValueDim strCountry As String = adUser.Profile.ProfileProperties.GetByName("CompanyCountry").PropertyValueDim strZip As String = adUser.Profile.ProfileProperties.GetByName("PostalCode").PropertyValueDim strPhone As String = adUser.Profile.ProfileProperties.GetByName("Phone").PropertyValue'need to get the objUser by userId so that the profile of the new user can be updated

 

userNew = UserController.GetUser(0, UserId,

userNew.Profile.SetProfileProperty(

userNew.Profile.SetProfileProperty(

userNew.Profile.SetProfileProperty(

userNew.Profile.SetProfileProperty(

userNew.Profile.SetProfileProperty(

userNew.Profile.SetProfileProperty(

ProfileController.UpdateUserProfile(userNew)

db.SubmitChanges()

Dim userNew As DotNetNuke.Entities.Users.UserInfoTrue)"Company", strCo)"CompanyAddress1", strCoAdd)"City", strCity)"CompanyCountry", strCountry)"PostalCode", strZip)"Phone", strPhone)

 

 
New Post
9/4/2008 3:30 PM
 

Does anyone know how to bypass the initial login screen asking the user to fill in required address information?  I would like to do that as a work-around.  I still want to require the fields for the "admin" (not a DNN admin) or main user of the portal, just not the users created by this module.  I realize it is weak, but I don't need the redundant info from them, and as long as they aren't promted to fill it in, they might never edit it?

 
New Post
12/19/2008 2:00 AM
 

Hi andym,

i am Hitesh Panchal. i have also find this issue in project. but i have resolve it.

i think you have create custom property name like "CompanyCountry". so it dnn will gives "Object reference not set to an instance of an object". error.

when ever you replace it with "FirstName" or "LastName".. dnn does not give any errors.. i think you got my point.

here is also one solution for how to Set Our Custom Property values using this SetProperty() method... just write this line above Set Property.

UserInfo oUserInfo = new UserInfo();

oUserInfo.Profile.InitialiseProfile(PortalSettings.PortalId);
oUserInfo.Profile.SetProfileProperty("CompanyCountry", txtCompanyName.Text);

i think it will be help you... when ever you solve this problem ping me...

Regards,

Hitesh Panchal
 

 

 
New Post
3/8/2010 10:38 AM
 
Perfect, the line: oUserInfo.Profile.InitialiseProfile(PortalSettings.PortalId); was what I was missing to
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1SetProfileProperty issueSetProfileProperty issue


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.