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

Forums / Developing with Sitefinity / Manage profile Control

Manage profile Control

3 posts, 0 answered
  1. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    26 Feb 2009
    Link to this post
    Hi

    Is there a way to change the layout of this control. It lists the attributes horizontally and is not aligned.

    Thanks.

    Kalpana
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    27 Feb 2009
    Link to this post
    Hi Kalpana,

    The layout of the ManageProfile control can be controlled through templates. So, we would suggest you wrap ManageProfile control in a user control and define the required layout in the provided templates (InsertTemplate, ViewTemplate, EditTemplate). Here is a simple example:

    .ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyProfile.ascx.cs" Inherits="UserControls_Custom_MyProfile" %> 
    <%@ Register Assembly="Telerik.Security" Namespace="Telerik.Security.WebControls" TagPrefix="cc1" %>   
      
    <cc1:ManageProfile ID="manageProfile" runat="server" Mode="edit" UsernameIfNoNames="false">  
        <EditTemplate>  
            <ol>  
                <li>  
                    <asp:Label ID="lblFirstName" runat="server" Text="First name" TargetID="FirstName"></asp:Label>  
                    <asp:TextBox ID="FirstName" runat="server"></asp:TextBox>  
                </li>  
                <li>  
                    <asp:Label ID="lblLastName" runat="server" Text="Last name" TargetID="LastName"></asp:Label>  
                    <asp:TextBox ID="LastName" runat="server"></asp:TextBox>  
                </li>  
            </ol>  
        </EditTemplate>  
    </cc1:ManageProfile>  
      
    <asp:LinkButton ID="cmdSaveUser" Text="Save" CommandName="Save" OnCommand="cmdSaveUser_Command" runat="server"></asp:LinkButton>  

    .ascx.cs
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.Security; 
    using Telerik.Security; 
     
    public partial class UserControls_Custom_MyProfile : System.Web.UI.UserControl 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!this.Page.IsPostBack) 
            { 
                MembershipUser user = UserManager.Default.GetUser(); 
     
                this.manageProfile.Mode = Telerik.Security.WebControls.ManageProfile.Modes.Edit; 
                this.manageProfile.Username = user.UserName; 
            } 
        } 
     
        protected void cmdSaveUser_Command(object sender, CommandEventArgs e) 
        { 
            try 
            { 
                MembershipUser user = UserManager.Default.GetUser(); 
                this.manageProfile.SetProfileProperties(user.UserName); 
                UserManager.Default.UpdateUser(user); 
            } 
            catch 
            { 
            } 
        }  
     

    Then, you need to register the newly created control in the <toolboxControls> section of the web.config file to display in the toolbox.

    Do let us know if this helps.

    All the best,
    Pepi
    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.
  3. Kalpana
    Kalpana avatar
    27 posts
    Registered:
    18 Dec 2008
    04 Mar 2009
    Link to this post
    Thank you. That really helped and I was able to change the layout.

    Kalpana
Register for webinar
3 posts, 0 answered