More in this section

Forums / Developing with Sitefinity / Default values for fields in ManageProfiel

Default values for fields in ManageProfiel

3 posts, 0 answered
  1. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    11 Oct 2007
    Link to this post
    Hi

    I am using your CreateUserWizardControl.ascx for register new members in the membership database. That works fine.
    But on the registration page I want to fill the (optional) fields FirstName and LastName in the ManageProfiel control with a default value.

    For the fields in the CreateUserWizard control this is possible (CreateUserWizard1.UserName = "test";), but I don't know how to do that for the ManageProfile fields

    Could you please tell me how to do that? Thanks in advance

    Regards
    Luc
  2. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    11 Oct 2007
    Link to this post
    Hello Luc Baeten,

    You can access the controls in the ManageProfile control through the FindControl(string ID) method of the current container. Here is some example code how to do this:
    ITextControl firstName = this.ManageProfile.GetCurrentContainer().FindControl("FirstName"as ITextControl;  
    if(firstName != null)  
       firstName.Text = "Your First Name";  
     


    Also you can set the default values for profile properties in web.config. Here is a way to do this:
    <properties> 
      <add name="FirstName" defaultValue="Your First Name"/>  
      <add name="LastName" defaultValue="Your Last Name"/>  
    </properties> 

    Kind regards,
    Yasen
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    11 Oct 2007
    Link to this post
    Thank you Yasen

    This is the way

    regards
    Luc
Register for webinar
3 posts, 0 answered