Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Mono Support How to have a custom register page? 

Viewed 10743 time(s) ,  4 post(s).   1 year ago  by ahung_nt 
1 ahung-nt
0 Reputation
9 Total posts
This content has not been rated yet. 
ahung_nt 1 year ago
Hi,

I want to have my custom page. I need more information in register page for users such as avatar, city, sex, career, and others. Is there some way to do this? or which class, method to do this. Thanks,

-------------
Best Regard
HungNavi
2 khorvat
6594 Reputation
919 Total posts
This content has not been rated yet. 
khorvat 1 year ago
Hi HungNavi,

I'll try to describe the best practice procedure of doing this in few short steps:

1. In root folder of the CMS create your project specific folder (in most cases we name it by the name of the project)
2. As we will be working with the Membership web part we need to create a sub folder called WebParts (to distignuish ordinary UserControls from WebParts )
3. Copy the "MembershipEditor.ascx" WebPart from the "\Portal\MonoX\ModuleGallery\Membership\MembershipEditor.ascx" to your web parts folder
4. Create your code behind file that will hold all your custom code etc. (don forget to change the "Inherits" property inside the mark-up of "MembershipEditor.ascx")
5. In the mark-up file you can add your own controls (city, etc.) e.g.

<asp:PlaceHolder ID="plhNewsletter" runat="server">
<dd style="margin: 0px; padding: 0px;">
<label> </label>
<asp:CheckBox ID="chNewsletter" runat="server" />
<label style="width: 60%; margin: 0px; padding: 0px; display: inline; text-align: left;" for="<%= chNewsletter.ClientID %>"><%= Resources.DefaultResources.Registration_Label_NewsletterSubscription %></label>
</dd>
</asp:PlaceHolder>
<asp:PlaceHolder ID="plhRememberMe" runat="server">
<dd style="margin: 0px; padding: 0px;">
<label> </label>
<asp:CheckBox ID="chkRememberMe" runat="server" />
<label style="width: 60%; margin: 0px; padding: 0px; display: inline; text-align: left;" for="<%= chkRememberMe.ClientID %>"><%= Resources.DefaultResources.MembershipEditor_RememberMe%></label>
</dd>
</asp:PlaceHolder>


6. Now you need to state that your class inherits from the "MonoSoftware.MonoX.ModuleGallery.MembershipEditor" e.g. "public partial class MembershipEditor : MonoSoftware.MonoX.ModuleGallery.MembershipEditor"

7. To execute your custom code you need to attach to some of the exposed events:

AccountCreating
AccountCreated
AccountCreationCompleted
AccountUpdating
AccountUpdated
AccountUpdateCompleted


To read more about this event please download MonoX API reference from here http://www.mono-software.com/Download/MonoX.chm.zip.

e.g.

void MembershipEditor_AccountCreated(object sender, MembershipModuleEventArgs e)
{
  AddUserToRole(e);
  PostAccountCreationActions(new Guid(e.MembershipUser.ProviderUserKey.ToString()));
  SendNotifications(e);
  AddUserProfile(new Guid(e.MembershipUser.ProviderUserKey.ToString()));
}


8. for all of your custom data we advise you to store that data in your own (separate) DB table

If you have any questions or you need clarification on how to do any of the described actions do not hesitate to contact us.

Regards
3 khorvat
6594 Reputation
919 Total posts
Rated 5.00, 1 vote(s). 
Answer
khorvat 1 year ago
One more thing I forgot to mention is that if you want a custom profile page (module) please refer to the following http://www.mono-software.com/blog/post/Mono/38/Support-for-ASP-NET-profiles-in-MonoX/

Regards
4 ahung-nt
0 Reputation
9 Total posts
This content has not been rated yet. 
ahung_nt 1 year ago
Hi Kristijan Horvat,

Thanks for your help.

-------------------
Best Regards,
HungNavi