1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / manually assign ManageProfile

manually assign ManageProfile

5 posts, 0 answered
  1. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    09 Oct 2007
    Link to this post
    In the createuserwizard user control sitefinity uses

    this.ManageProfile.SetProfileProperties(CreateUserWizard1.UserName);

    to set the profile properties. Is there a way to add items to the ProfileProperties collection manually so that we don't have to have the ManageProfile on the markup and could just use two textboxes in the createuserwizardStep of the createuserwizard?

    Sincerely,

    Ben

  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    09 Oct 2007
    Link to this post
    Hi Ben,

    If I understand correctly, you want to add user details in a user profile manually. If this is the case, there are several settings you need to add/do in the web.config, in Users.aspx and MyProfile.aspx, as well as Users.aspx.cs and MyProfile.aspx.cs. Detailed information about the settings could be found in the User Manual, page 152, in the Users and Roles section, titled Adding User Details.

    Please, let us know if we have understood you correctly.


    All the best,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    09 Oct 2007
    Link to this post

    My goal is not to add additional data to the Profile as in the "Nickname" example in the user manual. My goal is to manually assign values to the properties collection so that when 


    this.ManageProfile.SetProfileProperties(CreateUserWizard1.UserName);

    is called it inputs the appropriate values for firstname and lastname. Currently this is accomplished by

    <cc1:ManageProfile ID="manageProfile" runat="server" Mode="edit">  
                                        <EditTemplate> 
                                            <ol class="setIn">  
                                    <li> 
                                        <cc2:FieldLabel ID="lblFirstName" runat="server" Text="First name" TargetID="FirstName"></cc2:FieldLabel> 
                                        <asp:TextBox ID="FirstName" runat="server"></asp:TextBox> 
                                    </li> 
                                    <li> 
                                        <cc2:FieldLabel ID="lblLastName" runat="server" Text="Last name" TargetID="LastName"></cc2:FieldLabel> 
                                        <asp:TextBox ID="LastName" runat="server"></asp:TextBox> 
                                    </li> 
                                </ol> 
                                        </EditTemplate> 
                                    </cc1:ManageProfile> 

     and then calling 

    this.ManageProfile.SetProfileProperties(CreateUserWizard1.UserName);

    But I would like to avoid using the ManageProfile control. I hope that makes sense.

    Sicerely,

    Ben
  4. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    09 Oct 2007
    Link to this post
    I should clarify. That I want to avoid using the manageprofile control in the markup to update the firstname and lastname profile properties.

    I was hoping it would look something like.

    me.ManageProfile.firstname = txtFirst.text.trim
    me.ManageProfile.lastname = textless.text.trim

    Sincerely,

    Ben
  5. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    09 Oct 2007
    Link to this post
    Hi Ben,

    You can do that, it is quite easy. Actually in SetProfileProperties() the control iterates through the profile properties in the ProfileBase class so manipulation of the properties is not possible.

    The way to achieve your purpose is not to use the ManageProfile control (maybe that was your purpose).

    Here is a very simple example markup without the ManageProfie:

    <asp:TextBox ID="FirstName" runat="server" /> 
    <asp:TextBox ID="LastName" runat="server" /> 
     


    And in the code behind instead of SetProfileProperties() you should do something like this:

    ProfileBase profile = ProfileBase.Create("SomeUserName");  
    profile.SetPropertyValue("FirstName"this.FirstName.Text);  
    profile.SetPropertyValue("LastName"this.LastName.Text);  
    if(profile.IsDirty)  
        profile.Save(); 

    Also to populate this text boxes with data from the profile you could do something like:
    this.FirstName.Text = profile.GetPropertyValue("FirstName"); 

    Hope this information is helpful for you. We will be very happy to receive some feedback about the manageProfile control.

    Sincerely yours,
    Yasen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
5 posts, 0 answered