Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Biz Modules provides professional business modules and solutions for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Problem updating user
Previous Previous
 
Next Next
New Post 10/3/2007 4:03 AM
User is offline Jonathan
2 posts
10th Ranked


Problem updating user  

Hi all!

 

I'm relatively new to DNN and now I have my first problem that I can't fix. I simply can't update user info. To make it really simple I only try to update first name. I get no error message but user info doesn't update. I've tried to search tutorials and forums but I can't find any answers to my problem. Maybe I'm just blind..

I have ascx file with one textBox, one button and one RequiredFieldValidator. Here's parts of my vb code:

Imports DotNetNuke
Imports DotNetNuke.Entities.Users
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection

...

...

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
            Try
                If Page.IsValid Then
                    Dim cUser As New UserController
                    Dim iUser As UserInfo = cUser.GetUser(Me.PortalId, Me.UserId)
                    iUser.FirstName = Me.txtFirstName.Text
                    iUser.Profile.SetProfileProperty("FirstName", Me.txtFirstName.Text)
                    UserController.UpdateUser(Me.PortalId, iUser)
                End If
            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

If I use same code but instead of iUser.FirstName = Me.txtFirstName.Text I put iUser.FirstName = "MyName" the FirstName property does update. I have this same problem with DNN 3.7.7 and 4.5.5. I'm sure there is a simple way to solve this problem but I can't find it out.. Maybe my portal settings are wrong or I don't import all necessary items or something.

It would be nice if someone could tell me what I do wrong. And it would be even better if someone could point me a good tutorial of updating user.

 

Thanks!

 

 
New Post 10/5/2007 10:27 AM
User is offline Jonathan
2 posts
10th Ranked


Re: Problem updating user  

Okey... Problem solved and a lesson learnt. In Page_Load I set the text of txtFirstName outside If Not IsPostBack..... Now I set it inside if and everything works fine. Oh, and I use DNN 3.3.7 not 3.7.7.

 

I hope my time spent finding this reason will help someone else!

 
New Post 1/30/2008 6:14 PM
User is offline JM
3 posts
10th Ranked


Re: Problem updating user  

I'm doing the same sort of thing.  I am creating a user through the user controller and the UserInfo data updates fine.  I am also assigning the user to a role and that works.  What I can't figure out is why, when I try to add a value to a custom property I set up in the property definitions, the value does not get updated.  Here's a snapshot of my code:

 

                Dim salesman As New SalesmanInfo
                Dim dealerRoleInfo As New Security.Roles.RoleInfo
                dealerRoleInfo = _dnnroleController.GetRoleByName(PortalId, "Dealer")
                'Create the saleman DNN UserInfo object and hydrate it
                Dim slsmanUserInfo As New UserInfo

'Load up the salesman object with data from the form
                With salesman
                    .Name = Name.Text
                    .Company = Company.Text
                    If CorpRadioBtn.Checked = True Then
                        .Is_1099 = 0
                    ElseIf NonCorpRadioBtn.Checked = True Then
                        .Is_1099 = 1
                    Else
                        .Is_1099 = 0
                    End If
                    .Phone = Phone.Text
                    .FaxNumber = Fax.Text
                    .CellPhone = CellPhone.Text
                    .EmailAddress = Email.Text
                    .TaxID = TaxSSID.Text
                    .Address1 = Address1.Text
                    .Address2 = Address2.Text
                    .City = City.Text
                    .State = State.SelectedValue
                    .PostalCode = PostalCode.Text
                    .Country = Country.SelectedValue
                    .Account = Account.Text
                    .RoutingNumber = RoutingNumber.Text
                    .Currency = AccountCurrency.SelectedValue
                    .AcceptedAgreement = False
                    .Level = Level.SelectedIndex
                    If UserInfo.IsInRole("CSR") = True Or UserInfo.IsInRole("SM") = True Or UserInfo.IsInRole("Admin") = True Then
                        .SalesManagerID = TerritoryMgr.SelectedIndex
                    ElseIf UserInfo.IsInRole("TM") Then
                        .SalesManagerID = UserInfo.Profile.GetProperty("SalesmanID").PropertyValue
                    End If
                    .SalesmanClass = "005"
                End With

                'Create a new salesman in the database
                _hgpsUserController.CreateSalesman(salesman)

                'show the new salesman added by creating a read only view.
                Me.Dealer.SelectParameters.Clear()
                Me.Dealer.SelectParameters.Add("SalesmanID", salesman.SalesmanID)
                formView1.DataBind()
                formView1.ChangeMode(formViewMode.ReadOnly)

                'Populate the salesman DotNetNuke UserInfo object and save it
                With slsmanUserInfo
                    .DisplayName = Name.Text
                    .Email = Email.Text
                    .FirstName = Split(Name.Text, " ")(0)
                    .LastName = Split(Name.Text, " ")(1)
                    .PortalID = PortalId
                    .Username = UserID.Text
                    .Membership.Password = Password.Text
                End With

                'Create the salesman, update the salesmanID and add the user to the Dealer role
                UserController.CreateUser(slsmanUserInfo)
                DotNetNuke.Entities.Profile.ProfileController.GetUserProfile(slsmanUserInfo)
                slsmanUserInfo.Profile.SetProfileProperty("SalesmanID", salesman.SalesmanID.ToString)
                _dnnroleController.AddUserRole(PortalId, slsmanUserInfo.UserID, dealerRoleInfo.RoleID, Null.NullDate)

I don't receive any errors, it just doesn't update.   Any help would be greatly appreciated.

Thanks,
Jason

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Problem updating user
 


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.

 


Web Valley
Website design, Database development
www.webvalley.com
UK DotNetNuke CMS installation, hosting & support
UK based installation, branding, customising, integration, hosting, training, support and maintenance services for DotNetNuke
www.deburca.co.uk
Need Help with your DotNetNuke website?
Jango Studios offers exclusive DotNetNuke Skin Design, Module Development, Web Marketing and Web Hosting.
www.jangostudios.net

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP