Mono Support How to have a custom register page? 

Viewed 35573 time(s), 5 post(s), 12/15/2010 4:21:46 AM - by ahung_nt
12/15/2010 4:21:46 AM
0 Reputation 9 Total posts

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

1
2/15/2011 1:47:35 PM
15993 Reputation 2214 Total posts

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

2
12/16/2010 10:40:44 AM
15993 Reputation 2214 Total posts

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

3
12/16/2010 1:17:49 PM
0 Reputation 9 Total posts

Hi Kristijan Horvat,

Thanks for your help.

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

4
7/26/2013 9:39:12 AM
515 Reputation 67 Total posts

Do you have a sample code for this? i am trying to achieve something similar.

Thanks

5
This is a demo site for MonoX. Please visit Mono Software for more info.