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

User Profile

11 posts, 1 answered
  1. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    20 Jul 2009
    Link to this post

    I would like to add a new item to my user profile editing page.
    I have added a few already in the std way, but adding an entry in the web.config
    As well as adding text boxes in the Users.aspx as well as the MyProfile.aspx.
    What i would like to add is a RadEditor control. So that i can add more complex information.

    I have tried simply adding a RadEditor control like this:

     

     

     

    <li> 
     
     
    <cc2:FieldLabel ID="lblCompanyInfo" runat="server" Text="Company Info" TargetID="CompanyInfo">  
     
     
    </cc2:FieldLabel> 
     
     
    <telerik:RadEditor ID="CompanyInfo" runat="server"></telerik:RadEditor> 
     
     
    </li>   
     

     


    But it did not work. The data does not get stored. I assume the reason is that the system searches for Textboxes only.

    Is there a way to do what i am trying to achive?

  2. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    20 Jul 2009
    Link to this post
    Hi Andrew,

    One way I can think of getting around this is to Wrap the RadEditor in a Usercontrol and in the code behind have it implement the ITextControl interface, with the Text property mapped to the editors Content property.

    You can find an example on wrapping an editor here.

    Hope this helps.

    Sean
  3. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    20 Jul 2009
    Link to this post
    Hi Sean,

    I am afraid it does not apear to work for me.
    I copied the control to my project and used this like this:

     

    <%

    @ Register Src="~/UserControls/Events/RadEditorWrapper.ascx" TagName="RadEditorWrapper" TagPrefix="rew"%>

     


    <

     

    rew:RadEditorWrapper ID="CompanyInfo" runat="server"/>

    I enter some test text in the control and hit save. But nothing apears when i open the user again.
    The control is empty.

  4. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    20 Jul 2009
    Link to this post
    Point of clearification.
    It is the saving that does not work.
    If i use a text box to save it, and then swap it to the wrapper control, it loads the text just fine.
    But it does not save anything.
  5. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    21 Jul 2009
    Link to this post
    Hi Andrew,

    I am not sure why that wouldn't be working if you used the code from that example.  Are you using the latest version of Sitefinity?  Have you raised a support request with Telerik?

    A silly question but just to check the control you are adding is definitely inside the ManageProfile control right?

    Cheers
    Sean
  6. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    21 Jul 2009
    Link to this post
    Yes i am using the latest version of sitefinity. A blank project.
    The control i am adding is within the "sitefinity/admin/cmsadmin/Users.aspx" page it will also be in the "myprofile.aspx" page once i get it to work.

    Now it's time for me to ask a silly question.
    Have you actually tried this code youself? Or is it just something you found on the forum?

    Thanks for your help by the way.
    I will create a tciket and see if i can get some help this way.
    Funny thing is that it loeads the content fine, it's the saving that it does not do.

    A
  7. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    21 Jul 2009
    Link to this post
    Hi Andrew,

    I have used this control and this concept before yes with the RadEditor and other controls not with the latest version of SF though.  I have looked in reflector at the ManageProfile control too to double check and it looks for controls that use the ITextControl so I am not sure as to why it wouldn't be working for you.

    The support ticket is the best way to go anyway as you will get dedicated support from the Telerik team.  Maybe post back your solution here once you figure it out in case someone else has the same problem.

    Cheers
    Sean
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jul 2009
    Link to this post
    Hi,

    I can confirm that the ManageProfile uses ITextControls. The RadEditor does not have a Text property (and is not implementing the ITextControls interface). That is why you should make the "translator" to the RadEditor Content property. All the controls working with the profile are implementing this interface in the moment - FirstName, LastName etc.

    Andrew,
    Can you please show us your implementation?

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    21 Jul 2009
    Link to this post
    Georgi
    I have posted my code with a new support ticket.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    21 Jul 2009
    Link to this post
    Hi Andrew,

    We have just sent a reply to the ticket. Please check it out. If you want we could continue the discussion here or using the support request.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
    Answered
  11. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    28 Jul 2009
    Link to this post
    Thanks Ivan.

    For anyone interested in doing the same. It apears that this apreach will not work.
    You have to use a hidden text control to allow the system to retrive it.

    Here is some code provided by Ivan from the Telerik team:

    protected override void OnInit(EventArgs e)    
        {    
            base.OnInit(e);    
          ....     
              ....    
            manageUsers.CreatingUser += new ActionCancelEventHandler(manageUsers_CreatingUser);    
            manageUsers.UpdatingUser += new ActionCancelEventHandler(manageUsers_UpdatingUser);    
        }    
        
        void manageUsers_UpdatingUser(object source, ActionCancelEventArgs e)    
        {    
            var edk = manageUsers.GetCurrentContainer() as ManageUsers.EditContainer;    
            if(edk !=null)    
            {    
                var profile = FindControlRecursive(manageUsers, "manageProfile") as ManageProfile;    
                var box = FindControlRecursive(profile, "CompanyName") as TextBox;    
                var rEditor = FindControlRecursive(profile, "CompanyNameEditors") as RadEditor;    
                if (rEditor != null && box != null) box.Text = rEditor.Content.ToString();    
            }    
        
        }    
        
        private Control FindControlRecursive(Control root, string id)    
        {    
            if (root.ID == id)    
            {    
                return root;    
            }    
        
            foreach (Control c in root.Controls)    
            {    
                Control t = FindControlRecursive(c, id);    
                if (t != null)    
                {    
                    return t;    
                }    
            }    
        
            return null;    
        }     
        
    protected override void OnPreRender(EventArgs e)    
        {    
            base.OnPreRender(e);    
            Telerik.Security.WebControls.ManageUsers.EditContainer editContainer =    
                manageUsers.GetCurrentContainer() as Telerik.Security.WebControls.ManageUsers.EditContainer;    
            if (editContainer != null)    
            {    
        
                var profile = FindControlRecursive(editContainer, "manageProfile") as ManageProfile;    
                var box = FindControlRecursive(profile, "CompanyName") as TextBox;    
                var rEditor = FindControlRecursive(profile, "CompanyNameEditors") as RadEditor;    
                if (rEditor != null)    
                    rEditor.Content = box.Text;    
            }    
        }    
     
Register for webinar
11 posts, 1 answered