ASPX templates
Version 4.x > ASPX templates > Adding custom field to RegistrationForm in V4.x, using ASPX templates View modes: 
User avatar
Member
Member
Steve-Appetere - 4/30/2009 12:20:20 PM
   
Adding custom field to RegistrationForm in V4.x, using ASPX templates
I would like to add a custom field to the RegistrationForm webpart.

I have read the V3.x article on this (http://devnet.kentico.com/Knowledge-Base/Web-parts---Controls/Adding-custom-fields-into-RegistrationForm-web-par.aspx). However, it appears that in V4.x the procedure to save data to the database will be slightly different.

For example, in the code behind, I can see a UserInfo object being created to hold the form data


Line 551
ui = new UserInfo();
ui.PreferredCultureCode = "";
ui.Email = txtEmail.Text.Trim();
ui.FirstName = txtFirstName.Text.Trim();
ui.FullName = txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim();
ui.LastName = txtLastName.Text.Trim();

etc


If the correct approach is to add a custom field for my data (through CMSSiteManager -> System Tables -> User ), then how do I include my custom data in the UserInfo object so that it is saved?

Also, would it be worth creating a new Knowledge Base article for V4.x outlining the whole procedure?

Thanks

Steve

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/7/2009 4:52:19 AM
   
RE:Adding custom field to RegistrationForm in V4.x, using ASPX templates
Hi Steve,

you can still use this approach in version 4.0. You can use following function to set data into your custom field: ui.SetValue("NameOfField", value);

Since version 4.0 you can also use CustomRegistrationForm web part with custom alternative form instead. You can create custom form in "System tables -> User (or User - Settings) -> Alternative forms" section and then set this form into 'Alternative form' property of CustomRegistrationForm web part. Please see documentation for alternative forms for more details.

Best Regards,

Martin Dobsicek