MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

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.

using MonoX built in modules  (Mono Support )

Viewed 66008 time(s), 18 post(s) 1/6/2011 9:12:02 AMby inanc
denis

denis

1/8/2011 10:33:09 PM
I just pasted the TestProfile.aspx code to the fresh MonoX 4 install and sample project in Visual Studio 2010. Works without any problems.
I just did the same for another user on this forum, and it appears to be a fundamental glitch - you've must been using the sample project in a wrong way. To quickly diagnose what's going on, please zip the custom solution files without any changes and send it to our support address. We will restore your solution over the original install and try to debug it.
This content has not been rated yet. 
7207 Reputation 956 Total posts
inanc

inanc

1/10/2011 1:18:14 PM
Hello Denis,
Thank you very much for your interest. I've installaed your new version and tried the code again. I have no problem right now. Thank you again.
This content has not been rated yet. 
469 Reputation 60 Total posts
inanc

inanc

2/14/2011 9:52:53 PM
I would like to ask one more thing about MembershipEditor_AccountCreating event.
Let us assume that we want two additional profile fields stored another profile related table. Let's call them as HairColor and EyeColor. In the MemberShipEditor module I've added these two extra fields.
aspx part;

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MembershipEditor.ascx.cs" Inherits="ProjectName.Web.prDene.WebParts.MembershipEditor" %>
<%@ Import Namespace="MonoSoftware.MonoX.Resources"%>
<%@ Register TagPrefix="MonoX" TagName="StyledButton" Src="/MonoX/controls/StyledButton.ascx" %>
  
<div class="membership-module-container input-form" style="">
<div id="Div1" runat="server">
    <asp:ValidationSummary ID="validationSummary" CssClass="validation-summary" runat="server" />
</div>  
<div class="register">
    <h2><%= Page.User.Identity.IsAuthenticated ? DefaultResources.MembershipEditor_Title_UpdateAccount : DefaultResources.MembershipEditor_Title_CreateAccount %></h2>
    <dl>
        <dd>
            <label for="<%= txtUserName.ClientID %>"><%= DefaultResources.MembershipEditor_UserName %></label>
            <asp:Label ID="lblUserName" runat="server"></asp:Label>
            <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="vldRequiredUserName" runat="server" ControlToValidate="txtUserName" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
            <asp:CustomValidator ID="vldCustomUserName" runat="server" ControlToValidate="txtUserName" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
        </dd>
        <dd>
            <label for="<%= txtPassword.ClientID %>"><%= DefaultResources.MembershipEditor_Password %></label>
            <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="vldRequiredPassword" runat="server" ControlToValidate="txtPassword" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
        </dd>
        <dd>
            <label for="<%= txtRepeatPassword.ClientID %>"><%= DefaultResources.MembershipEditor_RepeatPassword %></label>
            <asp:TextBox ID="txtRepeatPassword" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="vldRequiredRepeatPassword" runat="server" ControlToValidate="txtRepeatPassword" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
            <asp:CompareValidator ID="vldCompareRepeatPassword" runat="server" ControlToValidate="txtRepeatPassword" Text="!" SetFocusOnError="true" ControlToCompare="txtPassword" Operator="Equal" CssClass="validator ValidatorAdapter" Display="Dynamic"></asp:CompareValidator>
        </dd>
        <dd>
            <label for="<%= txtEmail.ClientID %>"><%= DefaultResources.MembershipEditor_Email %></label>
            <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="vldRequiredEmail" runat="server" ControlToValidate="txtEmail" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
            <asp:RegularExpressionValidator ID="vldRegexEmail" runat="server" ControlToValidate="txtEmail" Text="!" SetFocusOnError="true" CssClass="validator ValidatorAdapter" Display="Dynamic" />
        </dd>
        <dd>
            <label>Hair Color</label>
            <asp:TextBox ID="txtHairColor" runat="server"></asp:TextBox>
        </dd>
        <dd>
            <label>Eye Color</label>
            <asp:TextBox ID="txtEyeColor" runat="server"></asp:TextBox>
        </dd>
        <asp:PlaceHolder ID="plhRememberMe" runat="server">
            <dd>
                <label> </label>
                <asp:CheckBox ID="chkRememberMe" runat="server" style="float: left;" />
                <label style="margin-top: 2px; float: left;" for="<%= chkRememberMe.ClientID %>"><%= DefaultResources.MembershipEditor_RememberMe %></label>                
            </dd>
        </asp:PlaceHolder>
        <dd>
            <asp:Label ID="labInfo" runat="server"></asp:Label>
        </dd>
    </dl>
    <div class="input-form">
        <div class="button-holder" style="float: right;">
            <MonoX:StyledButton ID="btnCreateAccount" runat="server" CssClass="CssFormButton" Text="Create"></MonoX:StyledButton>
            <MonoX:StyledButton ID="btnUpdateAccount" runat="server" CssClass="CssFormButton" Text="Update" Visible="false"></MonoX:StyledButton>
        </div>
    </div>
</div>    
</div>


and the codebehind file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX;
using MonoSoftware.MonoX.ModuleGallery;
  
namespace ProjectName.Web.prDene.WebParts
{
    public partial class MembershipEditor :MonoSoftware.MonoX.ModuleGallery.MembershipEditor
    {
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
        void MembershipEditor_AccountCreating(object sender, MembershipModuleEventArgs e)
        {
            int a = 456;
        }
        void MembershipEditor_AccountCreated(object sender, MembershipModuleEventArgs e)
        {
            int a = 456;
        }
    }
}

According to the note given on this forum, I've made my class inherited from "MonoSoftware.MonoX.ModuleGallery.MembershipEditor". But the problem is I can't the break the code while running on 'int a = 456;' lines.
How could I catch these special events in order to insert the additional profile felds to related tables. Thank you.
Inanc

This content has not been rated yet. 
469 Reputation 60 Total posts
khorvat

khorvat

2/14/2011 9:54:03 PM
Hi Inanc,

to catch these events you need to attach to them like this:

protected override void OnInit(EventArgs e)
{
   base.OnInit(e);
   base.AccountCreationCompleted += new EventHandler(ctlMembership_AccountCreationCompleted);
}
  
void ctlMembership_AccountCreationCompleted(object sender, EventArgs e)
{
  int a = 456;
}

Let us know if you need anything else.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
inanc

inanc

2/14/2011 9:54:48 PM
Dear Kristijan

The code given below doesn't catch the ctlMembership_AccountCreationCompleted evant. Do u have any idea? Thank you.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX;
using MonoSoftware.MonoX.ModuleGallery;
  
namespace ProjectName.Web.prDene.WebParts
{
    public partial class MembershipEditor :MonoSoftware.MonoX.ModuleGallery.MembershipEditor
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            base.AccountCreationCompleted += new EventHandler(ctlMembership_AccountCreationCompleted);
        }
  
        protected void Page_Load(object sender, EventArgs e)
        {
               
        }
  
        void ctlMembership_AccountCreationCompleted(object sender, EventArgs e)
        {
            int a = 456;
            txtEyeColor.Text = "tosbaga";
        }
  
    }
}
This content has not been rated yet. 
469 Reputation 60 Total posts
inanc

inanc

2/14/2011 9:55:33 PM
Ok.I found the error on OnInit. It should be :

protected override void OnInit(EventArgs e) 
base.AccountCreationCompleted += new EventHandler(ctlMembership_AccountCreationCompleted); 
base.OnInit(e); 

Custom event should be added before initializing.Thanks.
This content has not been rated yet. 
469 Reputation 60 Total posts
inanc

inanc

1/12/2011 10:12:42 AM
When I use the custom modules inherited for originals localization doesn’t work right. It writes First Name instead of ‘Ad’ on UserProfile section for example. ‘Ad’ means First Name in Turkish. But when using your original modules everything seem right. Do you have any idea?
Thank you
This content has not been rated yet. 
469 Reputation 60 Total posts
denis

denis

1/12/2011 1:37:59 PM
Please send the complete code to our support address (both ascx and ascx.cs files).
This content has not been rated yet. 
7207 Reputation 956 Total posts
1 2